Merge pull request #3984 from glassez/root_path

Fix TorrentHandle path methods. Closes #3847.
This commit is contained in:
sledgehammer999 2015-11-06 16:03:48 -06:00
commit 472fff06dc
9 changed files with 90 additions and 54 deletions

View file

@ -827,11 +827,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 {
@ -1736,7 +1732,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()) {