Merge pull request #6694 from glassez/remove-temp

Remove torrent temp folder when it becomes unneeded
This commit is contained in:
Vladimir Golovnev
2017-04-29 11:44:15 +03:00
committed by GitHub
4 changed files with 21 additions and 12 deletions

View File

@@ -100,7 +100,7 @@ QString Utils::Fs::folderName(const QString& file_path)
*/
bool Utils::Fs::smartRemoveEmptyFolderTree(const QString& path)
{
if (!QDir(path).exists())
if (path.isEmpty() || !QDir(path).exists())
return false;
static const QStringList deleteFilesList = {
@@ -161,9 +161,10 @@ bool Utils::Fs::forceRemove(const QString& file_path)
* Removes directory and its content recursively.
*
*/
void Utils::Fs::removeDirRecursive(const QString& dirName)
void Utils::Fs::removeDirRecursive(const QString &path)
{
QDir(dirName).removeRecursively();
if (!path.isEmpty())
QDir(path).removeRecursively();
}
/**

View File

@@ -59,7 +59,7 @@ namespace Utils
bool smartRemoveEmptyFolderTree(const QString& path);
bool forceRemove(const QString& file_path);
void removeDirRecursive(const QString& dirName);
void removeDirRecursive(const QString& path);
QString tempPath();
}