summaryrefslogtreecommitdiff
path: root/rbutil
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2007-10-12 16:54:51 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2007-10-12 16:54:51 +0000
commitabd8c39a4d10283819a6f13ef13f77434966aa93 (patch)
tree27d2343984bedbf12f7e4cc12c7053fd259266c4 /rbutil
parent79d358bacab7d8818e9db1f7e532e7ad07939ed8 (diff)
downloadrockbox-abd8c39a4d10283819a6f13ef13f77434966aa93.tar.gz
rockbox-abd8c39a4d10283819a6f13ef13f77434966aa93.zip
Code police and simplify function a bit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15089 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-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 @@
24// recursive function to delete a dir with files 24// recursive function to delete a dir with files
25bool recRmdir( const QString &dirName ) 25bool 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}