Fix TorrentHandle path methods. Closes #3847.

This commit is contained in:
Vladimir Golovnev (Glassez) 2015-10-24 15:28:29 +03:00
parent d0ebe08bf5
commit 501ab07024
8 changed files with 89 additions and 52 deletions

View file

@ -813,11 +813,7 @@ bool Session::deleteTorrent(const QString &hash, bool deleteLocalFiles)
// Remove it from session
if (deleteLocalFiles) {
QString tmp = torrent->filePath(0);
tmp.truncate(tmp.indexOf("/")); // get the torrent root directory name
if (!tmp.isEmpty())
m_savePathsToRemove[torrent->hash()] = torrent->actualSavePath() + tmp;
m_savePathsToRemove[torrent->hash()] = torrent->rootPath(true);
m_nativeSession->remove_torrent(torrent->nativeHandle(), libt::session::delete_files);
}
else {
@ -1722,7 +1718,7 @@ void Session::handleTorrentFinished(TorrentHandle *const torrent)
const QString torrentRelpath = torrent->filePath(i);
if (torrentRelpath.endsWith(".torrent", Qt::CaseInsensitive)) {
qDebug("Found possible recursive torrent download.");
const QString torrentFullpath = torrent->actualSavePath() + "/" + torrentRelpath;
const QString torrentFullpath = torrent->savePath(true) + "/" + torrentRelpath;
qDebug("Full subtorrent path is %s", qPrintable(torrentFullpath));
TorrentInfo torrentInfo = TorrentInfo::loadFromFile(torrentFullpath);
if (torrentInfo.isValid()) {