From 0b6cf54508f71785334c49dc0298748beea105aa Mon Sep 17 00:00:00 2001 From: "Vladimir Golovnev (qlassez)" Date: Sun, 13 Aug 2017 14:17:12 +0300 Subject: [PATCH] Don't remove shared temp folder Don't remove shared temp folder when torrent finished and moved to its "complete" folder. Only torrents with stripped root folder have subfolder in temp folder so they should remove it. --- src/base/bittorrent/torrenthandle.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/base/bittorrent/torrenthandle.cpp b/src/base/bittorrent/torrenthandle.cpp index 4a95ee9ea..715edbc61 100644 --- a/src/base/bittorrent/torrenthandle.cpp +++ b/src/base/bittorrent/torrenthandle.cpp @@ -1507,7 +1507,11 @@ void TorrentHandle::handleStorageMovedAlert(libtorrent::storage_moved_alert *p) } qDebug("Torrent is successfully moved from %s to %s", qPrintable(m_moveStorageInfo.oldPath), qPrintable(m_moveStorageInfo.newPath)); - if (QDir(m_moveStorageInfo.oldPath) == QDir(m_session->torrentTempPath(info()))) { + const QDir oldDir {m_moveStorageInfo.oldPath}; + if ((oldDir == QDir(m_session->torrentTempPath(info()))) + && (oldDir != QDir(m_session->tempPath()))) { + // torrent without root folder still has it in its temporary save path + // so its temp path isn't equal to temp path root qDebug() << "Removing torrent temp folder:" << m_moveStorageInfo.oldPath; Utils::Fs::smartRemoveEmptyFolderTree(m_moveStorageInfo.oldPath); }