source: smplayer/trunk/src/cleanconfig.cpp@ 165

Last change on this file since 165 was 165, checked in by Silvan Scherrer, 11 years ago

SMPlayer: update trunk to latest 0.8.7

File size: 1.3 KB
Line 
1
2#include "cleanconfig.h"
3#include <QFile>
4#include <QDir>
5
6#define DO_REMOVE
7
8void 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 + "/yt.js";
26 if (QFile::exists(s)) files_to_delete << s;
27
28 s = config_path + "/file_settings";
29 if (QFile::exists(s)) files_to_delete << listDir(s);
30
31 printf("Deleting files:\n");
32 for (int n = 0; n < files_to_delete.count(); n++) {
33 printf("Delete: %s\n", files_to_delete[n].toUtf8().constData());
34 #ifdef DO_REMOVE
35 QFile::remove(files_to_delete[n]);
36 #endif
37 }
38}
39
40QStringList CleanConfig::listDir(const QString &path) {
41 QDir dir(path);
42 QStringList file_list;
43
44 foreach(QString file, dir.entryList(QDir::Files)) {
45 file_list << QFileInfo(dir, file).absoluteFilePath();
46 }
47
48 foreach(QString sub_dir, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
49 file_list << listDir(path +"/"+ sub_dir);
50 }
51
52 return file_list;
53}
54
Note: See TracBrowser for help on using the repository browser.