diff options
Diffstat (limited to 'rbutil/rbutilqt')
-rw-r--r-- | rbutil/rbutilqt/utils.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/rbutil/rbutilqt/utils.cpp b/rbutil/rbutilqt/utils.cpp index c7c8371274..7458223e73 100644 --- a/rbutil/rbutilqt/utils.cpp +++ b/rbutil/rbutilqt/utils.cpp | |||
@@ -24,22 +24,21 @@ | |||
24 | // recursive function to delete a dir with files | 24 | // recursive function to delete a dir with files |
25 | bool recRmdir( const QString &dirName ) | 25 | bool recRmdir( const QString &dirName ) |
26 | { | 26 | { |
27 | QString dirN = dirName; | 27 | QString dirN = dirName; |
28 | QDir dir(dirN); | 28 | QDir dir(dirN); |
29 | QStringList list = dir.entryList(QDir::AllEntries); // make list of entries in directory | 29 | // make list of entries in directory |
30 | QFileInfo fileInfo; | 30 | QStringList list = dir.entryList(QDir::AllEntries | QDir::NoDotAndDotDot); |
31 | QString curItem, lstAt; | 31 | QFileInfo fileInfo; |
32 | for(int i = 0; i < list.size(); i++){ // loop through all items of list | 32 | QString curItem, lstAt; |
33 | QString name = list.at(i); | 33 | for(int i = 0; i < list.size(); i++){ // loop through all items of list |
34 | if(!(name == ".") && !(name == "..")){ | 34 | QString name = list.at(i); |
35 | curItem = dirN + "/" + name; | 35 | curItem = dirN + "/" + name; |
36 | fileInfo.setFile(curItem); | 36 | fileInfo.setFile(curItem); |
37 | if(fileInfo.isDir()) // is directory | 37 | if(fileInfo.isDir()) // is directory |
38 | recRmdir(curItem); // call recRmdir() recursively for deleting subdirectory | 38 | recRmdir(curItem); // call recRmdir() recursively for deleting subdirectory |
39 | else // is file | 39 | else // is file |
40 | QFile::remove(curItem); // ok, delete file | 40 | QFile::remove(curItem); // ok, delete file |
41 | } | 41 | } |
42 | } | 42 | dir.cdUp(); |
43 | dir.cdUp(); | 43 | return dir.rmdir(dirN); // delete empty dir and return if (now empty) dir-removing was successfull |
44 | return dir.rmdir(dirN); // delete empty dir and return if (now empty) dir-removing was successfull | ||
45 | } | 44 | } |