mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-28 21:38:51 +03:00
Fix torrent adding with existing data
This commit is contained in:
parent
f22aee2bff
commit
8e9b0d97ec
2 changed files with 14 additions and 14 deletions
|
@ -1331,10 +1331,7 @@ bool Session::addTorrent_impl(AddTorrentData addData, const MagnetUri &magnetUri
|
|||
p.max_uploads = pref->getMaxUploadsPerTorrent();
|
||||
|
||||
QString savePath;
|
||||
// Set actual save path (e.g. temporary folder)
|
||||
if (isTempPathEnabled() && !addData.disableTempPath && !addData.hasSeedStatus)
|
||||
savePath = m_tempPath;
|
||||
else if (addData.savePath.isEmpty()) // using Advanced mode
|
||||
if (addData.savePath.isEmpty()) // using Advanced mode
|
||||
savePath = categorySavePath(addData.category);
|
||||
else // using Simple mode
|
||||
savePath = addData.savePath;
|
||||
|
|
|
@ -215,15 +215,9 @@ TorrentHandle::TorrentHandle(Session *session, const libtorrent::torrent_handle
|
|||
|
||||
updateStatus();
|
||||
m_hash = InfoHash(m_nativeStatus.info_hash);
|
||||
adjustActualSavePath();
|
||||
|
||||
if (!data.resumed) {
|
||||
if (!data.resumed)
|
||||
setSequentialDownload(data.sequential);
|
||||
if (hasMetadata()) {
|
||||
if (m_session->isAppendExtensionEnabled())
|
||||
appendExtensionsToIncompleteFiles();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TorrentHandle::~TorrentHandle() {}
|
||||
|
@ -1475,6 +1469,7 @@ void TorrentHandle::handleTorrentCheckedAlert(libtorrent::torrent_checked_alert
|
|||
m_hasSeedStatus = true;
|
||||
|
||||
adjustActualSavePath();
|
||||
appendExtensionsToIncompleteFiles();
|
||||
|
||||
if (m_pauseAfterRecheck) {
|
||||
m_pauseAfterRecheck = false;
|
||||
|
@ -1727,14 +1722,22 @@ void TorrentHandle::appendExtensionsToIncompleteFiles()
|
|||
{
|
||||
QVector<qreal> fp = filesProgress();
|
||||
for (int i = 0; i < filesCount(); ++i) {
|
||||
QString name = filePath(i);
|
||||
if ((fileSize(i) > 0) && (fp[i] < 1)) {
|
||||
const QString name = filePath(i);
|
||||
if (!name.endsWith(QB_EXT)) {
|
||||
const QString newName = name + QB_EXT;
|
||||
qDebug("Renaming %s to %s", qPrintable(name), qPrintable(newName));
|
||||
qDebug() << "Renaming" << name << "to" << newName;
|
||||
renameFile(i, newName);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (name.endsWith(QB_EXT)) {
|
||||
const QString oldName = name;
|
||||
name.chop(QString(QB_EXT).size());
|
||||
qDebug() << "Renaming" << oldName << "to" << name;
|
||||
renameFile(i, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1770,7 +1773,7 @@ void TorrentHandle::adjustActualSavePath_impl()
|
|||
else {
|
||||
// Moving all downloading torrents to temporary save path
|
||||
path = m_session->tempPath();
|
||||
qDebug("Moving torrent to its temp save path: %s", qPrintable(path));
|
||||
qDebug() << "Moving torrent to its temp save path:" << path;
|
||||
}
|
||||
|
||||
moveStorage(Utils::Fs::toNativePath(path));
|
||||
|
|
Loading…
Reference in a new issue