mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-08 00:22:31 -06:00
Save relative paths in fastresume files
Conditionally change absolute paths to relative in the fastresume data files. The condition is specified by user via a command line parameter and paths are relative to the profile dir. On Windows the convertion to relative path is performed if the path and the profile are on the same drive only.
This commit is contained in:
@@ -3633,7 +3633,8 @@ namespace
|
||||
if (ec || (fast.type() != libt::bdecode_node::dict_t)) return false;
|
||||
#endif
|
||||
|
||||
torrentData.savePath = Utils::Fs::fromNativePath(QString::fromStdString(fast.dict_find_string_value("qBt-savePath")));
|
||||
torrentData.savePath = Profile::instance().fromPortablePath(
|
||||
Utils::Fs::fromNativePath(QString::fromStdString(fast.dict_find_string_value("qBt-savePath"))));
|
||||
torrentData.ratioLimit = QString::fromStdString(fast.dict_find_string_value("qBt-ratioLimit")).toDouble();
|
||||
// **************************************************************************************
|
||||
// Workaround to convert legacy label to category
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
|
||||
#include "base/logger.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/profile.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/misc.h"
|
||||
@@ -1477,7 +1478,11 @@ void TorrentHandle::handleSaveResumeDataAlert(libtorrent::save_resume_data_alert
|
||||
resumeData["qBt-paused"] = isPaused();
|
||||
resumeData["qBt-forced"] = isForced();
|
||||
}
|
||||
resumeData["qBt-savePath"] = m_useAutoTMM ? "" : m_savePath.toStdString();
|
||||
else {
|
||||
auto savePath = resumeData.find_key("save_path")->string();
|
||||
resumeData["save_path"] = Profile::instance().toPortablePath(QString::fromStdString(savePath)).toStdString();
|
||||
}
|
||||
resumeData["qBt-savePath"] = m_useAutoTMM ? "" : Profile::instance().toPortablePath(m_savePath).toStdString();
|
||||
resumeData["qBt-ratioLimit"] = QString::number(m_ratioLimit).toStdString();
|
||||
resumeData["qBt-category"] = m_category.toStdString();
|
||||
resumeData["qBt-name"] = m_name.toStdString();
|
||||
|
||||
Reference in New Issue
Block a user