summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rbutil/rbutilqt/utils.cpp33
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 @@
// recursive function to delete a dir with files
bool recRmdir( const QString &dirName )
{
- QString dirN = dirName;
- QDir dir(dirN);
- QStringList list = dir.entryList(QDir::AllEntries); // make list of entries in directory
- QFileInfo fileInfo;
- QString curItem, lstAt;
- for(int i = 0; i < list.size(); i++){ // loop through all items of list
- QString name = list.at(i);
- if(!(name == ".") && !(name == "..")){
- curItem = dirN + "/" + name;
- fileInfo.setFile(curItem);
- if(fileInfo.isDir()) // is directory
- recRmdir(curItem); // call recRmdir() recursively for deleting subdirectory
- else // is file
- QFile::remove(curItem); // ok, delete file
+ QString dirN = dirName;
+ QDir dir(dirN);
+ // make list of entries in directory
+ QStringList list = dir.entryList(QDir::AllEntries | QDir::NoDotAndDotDot);
+ QFileInfo fileInfo;
+ QString curItem, lstAt;
+ for(int i = 0; i < list.size(); i++){ // loop through all items of list
+ QString name = list.at(i);
+ curItem = dirN + "/" + name;
+ fileInfo.setFile(curItem);
+ if(fileInfo.isDir()) // is directory
+ recRmdir(curItem); // call recRmdir() recursively for deleting subdirectory
+ else // is file
+ QFile::remove(curItem); // ok, delete file
}
- }
- dir.cdUp();
- return dir.rmdir(dirN); // delete empty dir and return if (now empty) dir-removing was successfull
+ dir.cdUp();
+ return dir.rmdir(dirN); // delete empty dir and return if (now empty) dir-removing was successfull
}