Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool RemoveDirectory(QDir &aDir)
- {
- bool has_err = false;
- if (aDir.exists())//QDir::NoDotAndDotDot
- {
- QFileInfoList entries = aDir.entryInfoList(QDir::NoDotAndDotDot |
- QDir::Dirs | QDir::Files);
- int count = entries.size();
- for (int idx = 0; ((idx < count) && (RBCFS_OK == has_err)); idx++)
- {
- QFileInfo entryInfo = entries[idx];
- QString path = entryInfo.absoluteFilePath();
- if (entryInfo.isDir())
- {
- has_err = RemoveDirectory(QDir(path));
- }
- else
- {
- QFile file(path);
- if (!file.remove())
- has_err = true;
- }
- }
- if (!aDir.rmdir(aDir.absolutePath()))
- has_err = true;
- }
- return(has_err);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement