From 9a7c670de973d9d4cb7357150d74a53e941ee8f2 Mon Sep 17 00:00:00 2001 From: APTX Date: Fri, 26 Apr 2013 21:53:48 +0200 Subject: [PATCH] Do not remove watched directories. --- localmylist/renamehandler.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/localmylist/renamehandler.cpp b/localmylist/renamehandler.cpp index a3c6ef5..75fc24a 100644 --- a/localmylist/renamehandler.cpp +++ b/localmylist/renamehandler.cpp @@ -56,6 +56,8 @@ void RenameHandler::handleRename() t.commit(); + QStringList watchedDirectories = db->getWatchedDirectories(MyList::instance()->hostId()); + while (q.next()) { QSqlRecord r = q.record(); @@ -184,6 +186,12 @@ void RenameHandler::handleRename() dir.setFilter(QDir::NoDotAndDotDot | QDir::AllEntries); while (!dir.count()) { + for (const QString &path : watchedDirectories) + { + QDir watchedDirectory(path); + if (dir.canonicalPath() == watchedDirectory.canonicalPath()) + goto endDirRemove; + } // QDir::rmdir only removes empty directories if (!dir.rmdir(dir.canonicalPath())) { @@ -193,6 +201,7 @@ void RenameHandler::handleRename() if (!dir.cdUp()) break; } +endDirRemove: ; } emit renameBatchFinished(); -- 2.52.0