Browse Source

Fix torrent temporary path functionality

adaptive-webui-19844
Christophe Dumez 12 years ago
parent
commit
eb726c42c6
  1. 23
      src/qtlibtorrent/qbtsession.cpp

23
src/qtlibtorrent/qbtsession.cpp

@ -938,7 +938,7 @@ QTorrentHandle QBtSession::addMagnetUri(QString magnet_uri, bool resumed, bool f
} }
if (savePath.isEmpty()) if (savePath.isEmpty())
savePath = getSavePath(hash, false); savePath = getSavePath(hash, false);
if (!defaultTempPath.isEmpty() && !TorrentPersistentData::isSeed(hash) && !resumed) { if (!defaultTempPath.isEmpty() && !TorrentPersistentData::isSeed(hash)) {
qDebug("addMagnetURI: Temp folder is enabled."); qDebug("addMagnetURI: Temp folder is enabled.");
QString torrent_tmp_path = defaultTempPath.replace("\\", "/"); QString torrent_tmp_path = defaultTempPath.replace("\\", "/");
p.save_path = torrent_tmp_path.toUtf8().constData(); p.save_path = torrent_tmp_path.toUtf8().constData();
@ -969,12 +969,6 @@ QTorrentHandle QBtSession::addMagnetUri(QString magnet_uri, bool resumed, bool f
} }
Q_ASSERT(h.hash() == hash); Q_ASSERT(h.hash() == hash);
// If temp path is enabled, move torrent
if (!defaultTempPath.isEmpty() && !resumed) {
qDebug("Temp folder is enabled, moving new torrent to temp folder");
h.move_storage(defaultTempPath);
}
loadTorrentSettings(h); loadTorrentSettings(h);
// Load filtered files // Load filtered files
@ -1127,7 +1121,7 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr
} else { } else {
savePath = getSavePath(hash, fromScanDir, path); savePath = getSavePath(hash, fromScanDir, path);
} }
if (!defaultTempPath.isEmpty() && !TorrentPersistentData::isSeed(hash) && !resumed) { if (!defaultTempPath.isEmpty() && !TorrentPersistentData::isSeed(hash)) {
qDebug("addTorrent::Temp folder is enabled."); qDebug("addTorrent::Temp folder is enabled.");
QString torrent_tmp_path = defaultTempPath.replace("\\", "/"); QString torrent_tmp_path = defaultTempPath.replace("\\", "/");
p.save_path = torrent_tmp_path.toUtf8().constData(); p.save_path = torrent_tmp_path.toUtf8().constData();
@ -1155,19 +1149,6 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr
return h; return h;
} }
// If temp path is enabled, move torrent
// XXX: The torrent is moved after the torrent_checked_alert
// is received to make sure we don't move a completed torrent (#602938)
/*if (!defaultTempPath.isEmpty() && !resumed) {
qDebug("Temp folder is enabled, moving new torrent to temp folder");
QString torrent_tmp_path = defaultTempPath.replace("\\", "/");
if (!root_folder.isEmpty()) {
if (!torrent_tmp_path.endsWith("/")) torrent_tmp_path += "/";
torrent_tmp_path += root_folder;
}
h.move_storage(torrent_tmp_path);
}*/
loadTorrentSettings(h); loadTorrentSettings(h);
if (!resumed) { if (!resumed) {

Loading…
Cancel
Save