|
Last change
on this file since 187 was 181, checked in by Silvan Scherrer, 9 years ago |
|
smplayer: update trunk to version 16.8.0
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 |
|
|---|
| 2 | #include "cleanconfig.h"
|
|---|
| 3 | #include <QFile>
|
|---|
| 4 | #include <QDir>
|
|---|
| 5 |
|
|---|
| 6 | #define DO_REMOVE
|
|---|
| 7 | //#define REMOVE_FILE_SETTINGS
|
|---|
| 8 |
|
|---|
| 9 | void CleanConfig::clean(const QString & config_path) {
|
|---|
| 10 | qDebug("CleanConfig::clean");
|
|---|
| 11 |
|
|---|
| 12 | QStringList files;
|
|---|
| 13 | files << "smplayer.ini" << "styles.ass" << "smplayer_files.ini"
|
|---|
| 14 | << "ytcode.script" << "yt.js" << "sig.ini" << "player_info.ini"
|
|---|
| 15 | << "device_info.ini" << "hdpi.ini" << "playlist.ini";
|
|---|
| 16 |
|
|---|
| 17 | QStringList files_to_delete;
|
|---|
| 18 |
|
|---|
| 19 | foreach(QString f, files) {
|
|---|
| 20 | QString s = config_path +"/"+ f;
|
|---|
| 21 | if (QFile::exists(s)) files_to_delete << s;
|
|---|
| 22 | }
|
|---|
| 23 |
|
|---|
| 24 | #ifdef REMOVE_FILE_SETTINGS
|
|---|
| 25 | QString s = config_path + "/file_settings";
|
|---|
| 26 | if (QFile::exists(s)) files_to_delete << listDir(s);
|
|---|
| 27 | #endif
|
|---|
| 28 |
|
|---|
| 29 | printf("Deleting files:\n");
|
|---|
| 30 | for (int n = 0; n < files_to_delete.count(); n++) {
|
|---|
| 31 | printf("Delete: %s\n", files_to_delete[n].toUtf8().constData());
|
|---|
| 32 | #ifdef DO_REMOVE
|
|---|
| 33 | QFile::remove(files_to_delete[n]);
|
|---|
| 34 | #endif
|
|---|
| 35 | }
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 38 | QStringList CleanConfig::listDir(const QString &path) {
|
|---|
| 39 | QDir dir(path);
|
|---|
| 40 | QStringList file_list;
|
|---|
| 41 |
|
|---|
| 42 | foreach(QString file, dir.entryList(QDir::Files)) {
|
|---|
| 43 | file_list << QFileInfo(dir, file).absoluteFilePath();
|
|---|
| 44 | }
|
|---|
| 45 |
|
|---|
| 46 | foreach(QString sub_dir, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
|
|---|
| 47 | file_list << listDir(path +"/"+ sub_dir);
|
|---|
| 48 | }
|
|---|
| 49 |
|
|---|
| 50 | return file_list;
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.