[search engine] Remove python3 cache during updateNova()

This commit is contained in:
DoumanAsh 2015-06-11 20:43:41 +03:00
commit 1222dab6f8
3 changed files with 27 additions and 3 deletions

View file

@ -178,6 +178,27 @@ bool Utils::Fs::forceRemove(const QString& file_path)
return f.remove();
}
/**
* Removes directory and its content recursively.
*
*/
void Utils::Fs::removeDirRecursive(const QString& dirName) {
QDir dir(dirName);
if (!dir.exists()) return;
Q_FOREACH(QFileInfo info, dir.entryInfoList(QDir::NoDotAndDotDot |
QDir::System |
QDir::Hidden |
QDir::AllDirs |
QDir::Files, QDir::DirsFirst)) {
if (info.isDir()) removeDirRecursive(info.absoluteFilePath());
else forceRemove(info.absoluteFilePath());
}
dir.rmdir(dirName);
}
/**
* Returns the size of a file.
* If the file is a folder, it will compute its size based on its content.

View file

@ -57,6 +57,7 @@ namespace Utils
QString expandPathAbs(const QString& path);
bool smartRemoveEmptyFolderTree(const QString& dir_path);
bool forceRemove(const QString& file_path);
void removeDirRecursive(const QString& dirName);
/* Ported from Qt4 to drop dependency on QtGui */
QString QDesktopServicesDataLocation();