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

Last change on this file since 176 was 176, checked in by Silvan Scherrer, 9 years ago

smplayer: update trunk to version 16.4

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 + "/player_info.ini";
29 if (QFile::exists(s)) files_to_delete << s;
30
31 s = config_path + "/file_settings";
32 if (QFile::exists(s)) files_to_delete << listDir(s);
33
34 printf("Deleting files:\n");
35 for (int n = 0; n < files_to_delete.count(); n++) {
36 printf("Delete: %s\n", files_to_delete[n].toUtf8().constData());
37 #ifdef DO_REMOVE
38 QFile::remove(files_to_delete[n]);
39 #endif
40 }
41}
42
43QStringList CleanConfig::listDir(const QString &path) {
44 QDir dir(path);
45 QStringList file_list;
46
47 foreach(QString file, dir.entryList(QDir::Files)) {
48 file_list << QFileInfo(dir, file).absoluteFilePath();
49 }
50
51 foreach(QString sub_dir, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
52 file_list << listDir(path +"/"+ sub_dir);
53 }
54
55 return file_list;
56}
57
Note: See TracBrowser for help on using the repository browser.