Browse Source

Fix importing of torrents from qBT < v2.3.0 when using a temporary folder for incomplete torrents

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
9e4958e96a
  1. 15
      src/bittorrent.cpp
  2. 4
      src/src.pro

15
src/bittorrent.cpp

@ -879,7 +879,13 @@ QTorrentHandle Bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
const QString &savePath = getSavePath(hash, false, QString::null, torrent_name); const QString &savePath = getSavePath(hash, false, QString::null, torrent_name);
if(!defaultTempPath.isEmpty() && resumed && !TorrentPersistentData::isSeed(hash)) { if(!defaultTempPath.isEmpty() && resumed && !TorrentPersistentData::isSeed(hash)) {
qDebug("addMagnetURI: Temp folder is enabled."); qDebug("addMagnetURI: Temp folder is enabled.");
p.save_path = defaultTempPath.toLocal8Bit().constData(); qDebug("addTorrent::Temp folder is enabled.");
QString torrent_tmp_path = defaultTempPath.replace("\\", "/");
if(!torrent_name.isEmpty()) {
if(!torrent_tmp_path.endsWith("/")) torrent_tmp_path += "/";
torrent_tmp_path += torrent_name;
}
p.save_path = torrent_tmp_path.toLocal8Bit().constData();
qDebug("addMagnetURI: using save_path: %s", qPrintable(defaultTempPath)); qDebug("addMagnetURI: using save_path: %s", qPrintable(defaultTempPath));
} else { } else {
p.save_path = savePath.toLocal8Bit().constData(); p.save_path = savePath.toLocal8Bit().constData();
@ -1118,7 +1124,12 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
} }
if(!defaultTempPath.isEmpty() && resumed && !TorrentPersistentData::isSeed(hash)) { if(!defaultTempPath.isEmpty() && resumed && !TorrentPersistentData::isSeed(hash)) {
qDebug("addTorrent::Temp folder is enabled."); qDebug("addTorrent::Temp folder is enabled.");
p.save_path = defaultTempPath.toLocal8Bit().constData(); QString torrent_tmp_path = defaultTempPath.replace("\\", "/");
if(!root_folder.isEmpty()) {
if(!torrent_tmp_path.endsWith("/")) torrent_tmp_path += "/";
torrent_tmp_path += root_folder;
}
p.save_path = torrent_tmp_path.toLocal8Bit().constData();
qDebug("addTorrent: using save_path: %s", qPrintable(defaultTempPath)); qDebug("addTorrent: using save_path: %s", qPrintable(defaultTempPath));
} else { } else {
p.save_path = savePath.toLocal8Bit().constData(); p.save_path = savePath.toLocal8Bit().constData();

4
src/src.pro

@ -12,9 +12,9 @@ CONFIG += qt \
# Update this VERSION for each release # Update this VERSION for each release
os2 { os2 {
DEFINES += VERSION=\'\"v2.3.0rc1\"\' DEFINES += VERSION=\'\"v2.3.0rc2\"\'
} else { } else {
DEFINES += VERSION=\\\"v2.3.0rc1\\\" DEFINES += VERSION=\\\"v2.3.0rc2\\\"
} }
DEFINES += VERSION_MAJOR=2 DEFINES += VERSION_MAJOR=2
DEFINES += VERSION_MINOR=3 DEFINES += VERSION_MINOR=3

Loading…
Cancel
Save