Properly remove empty leftover folders after rename

TorrentInfo::origFilePath will return the very original path from
.torrent file, not the most recent file path before the rename operation
and thus the code would not be working as we expected.
This commit is contained in:
Chocobo1
2019-06-04 20:46:41 +08:00
parent 3a0f0c2f58
commit 440860c4a9
5 changed files with 63 additions and 30 deletions

View File

@@ -204,15 +204,6 @@ void TorrentContentTreeView::renameSelectedFile(BitTorrent::TorrentHandle *torre
if (needForceRecheck)
torrent->forceRecheck();
// Remove old folder
const QString oldFullPath = torrent->savePath(true) + oldPath;
int timeout = 10;
while (!QDir().rmpath(oldFullPath) && (timeout > 0)) {
// FIXME: We should not sleep here (freezes the UI for 1 second)
QThread::msleep(100);
--timeout;
}
model->setData(modelIndex, newName);
}
}