mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Merge pull request #4037 from glassez/label
Fix 'Append label to save path'. Closes #4031.
This commit is contained in:
commit
e204562f4d
@ -1026,7 +1026,7 @@ bool Session::addTorrent(const TorrentInfo &torrentInfo, const AddTorrentParams
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add a torrent to the BitTorrent session
|
// Add a torrent to the BitTorrent session
|
||||||
bool Session::addTorrent_impl(const AddTorrentData &addData, const MagnetUri &magnetUri,
|
bool Session::addTorrent_impl(AddTorrentData addData, const MagnetUri &magnetUri,
|
||||||
const TorrentInfo &torrentInfo, const QByteArray &fastresumeData)
|
const TorrentInfo &torrentInfo, const QByteArray &fastresumeData)
|
||||||
{
|
{
|
||||||
libt::add_torrent_params p;
|
libt::add_torrent_params p;
|
||||||
@ -1098,21 +1098,21 @@ bool Session::addTorrent_impl(const AddTorrentData &addData, const MagnetUri &ma
|
|||||||
p.max_connections = pref->getMaxConnecsPerTorrent();
|
p.max_connections = pref->getMaxConnecsPerTorrent();
|
||||||
p.max_uploads = pref->getMaxUploadsPerTorrent();
|
p.max_uploads = pref->getMaxUploadsPerTorrent();
|
||||||
|
|
||||||
|
if (addData.savePath.isEmpty()) {
|
||||||
|
addData.savePath = m_defaultSavePath;
|
||||||
|
if (m_appendLabelToSavePath && !addData.label.isEmpty())
|
||||||
|
addData.savePath += QString("%1/").arg(addData.label);
|
||||||
|
}
|
||||||
|
else if (!addData.savePath.endsWith("/")) {
|
||||||
|
addData.savePath += "/";
|
||||||
|
}
|
||||||
|
|
||||||
QString savePath;
|
QString savePath;
|
||||||
// Set actual save path (e.g. temporary folder)
|
// Set actual save path (e.g. temporary folder)
|
||||||
if (isTempPathEnabled() && !addData.disableTempPath && !addData.hasSeedStatus) {
|
if (isTempPathEnabled() && !addData.disableTempPath && !addData.hasSeedStatus)
|
||||||
savePath = m_tempPath;
|
savePath = m_tempPath;
|
||||||
}
|
else
|
||||||
else {
|
|
||||||
savePath = addData.savePath;
|
savePath = addData.savePath;
|
||||||
if (savePath.isEmpty()) {
|
|
||||||
savePath = m_defaultSavePath;
|
|
||||||
if (m_appendLabelToSavePath && !addData.label.isEmpty())
|
|
||||||
savePath += QString("%1/").arg(addData.label);
|
|
||||||
}
|
|
||||||
else if (!savePath.endsWith("/"))
|
|
||||||
savePath += "/";
|
|
||||||
}
|
|
||||||
|
|
||||||
p.save_path = Utils::String::toStdString(Utils::Fs::toNativePath(savePath));
|
p.save_path = Utils::String::toStdString(Utils::Fs::toNativePath(savePath));
|
||||||
// Check if save path exists, creating it otherwise
|
// Check if save path exists, creating it otherwise
|
||||||
|
@ -289,7 +289,7 @@ namespace BitTorrent
|
|||||||
void setAppendExtension(bool append);
|
void setAppendExtension(bool append);
|
||||||
|
|
||||||
void startUpTorrents();
|
void startUpTorrents();
|
||||||
bool addTorrent_impl(const AddTorrentData &addData, const MagnetUri &magnetUri,
|
bool addTorrent_impl(AddTorrentData addData, const MagnetUri &magnetUri,
|
||||||
const TorrentInfo &torrentInfo = TorrentInfo(),
|
const TorrentInfo &torrentInfo = TorrentInfo(),
|
||||||
const QByteArray &fastresumeData = QByteArray());
|
const QByteArray &fastresumeData = QByteArray());
|
||||||
|
|
||||||
|
@ -202,9 +202,6 @@ TorrentHandle::TorrentHandle(Session *session, const libtorrent::torrent_handle
|
|||||||
, m_pauseAfterRecheck(false)
|
, m_pauseAfterRecheck(false)
|
||||||
, m_needSaveResumeData(false)
|
, m_needSaveResumeData(false)
|
||||||
{
|
{
|
||||||
if (m_savePath.isEmpty())
|
|
||||||
m_savePath = Utils::Fs::toNativePath(m_session->defaultSavePath());
|
|
||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
if (!data.resumed) {
|
if (!data.resumed) {
|
||||||
|
Loading…
Reference in New Issue
Block a user