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