From f067b8b37cbb0aaf96e064554b660d6f17aaffcd Mon Sep 17 00:00:00 2001 From: "Vladimir Golovnev (qlassez)" Date: Fri, 4 Aug 2017 22:29:17 +0300 Subject: [PATCH] Don't remove shared temp folder --- src/base/bittorrent/session.cpp | 13 ++++++------- src/base/bittorrent/torrenthandle.h | 3 ++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index 643842b92..8aa5d4ade 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -1651,14 +1651,13 @@ bool Session::deleteTorrent(const QString &hash, bool deleteLocalFiles) // Remove it from session if (deleteLocalFiles) { - if (torrent->savePath(true) == torrentTempPath(torrent->info())) { + QString rootPath = torrent->rootPath(true); + if (!rootPath.isEmpty()) + // torrent with root folder + m_savePathsToRemove[torrent->hash()] = rootPath; + else if (torrent->useTempPath()) + // torrent without root folder still has it in its temporary save path m_savePathsToRemove[torrent->hash()] = torrent->savePath(true); - } - else { - QString rootPath = torrent->rootPath(true); - if (!rootPath.isEmpty()) - m_savePathsToRemove[torrent->hash()] = rootPath; - } m_nativeSession->remove_torrent(torrent->nativeHandle(), libt::session::delete_files); } else { diff --git a/src/base/bittorrent/torrenthandle.h b/src/base/bittorrent/torrenthandle.h index 8dcba9812..f85358750 100644 --- a/src/base/bittorrent/torrenthandle.h +++ b/src/base/bittorrent/torrenthandle.h @@ -244,6 +244,8 @@ namespace BitTorrent QString rootPath(bool actual = false) const; QString contentPath(bool actual = false) const; + bool useTempPath() const; + bool isAutoTMMEnabled() const; void setAutoTMMEnabled(bool enabled); QString category() const; @@ -416,7 +418,6 @@ namespace BitTorrent void handleStatsAlert(libtorrent::stats_alert *p); bool isMoveInProgress() const; - bool useTempPath() const; QString nativeActualSavePath() const; void adjustActualSavePath();