|
|
|
@ -2611,50 +2611,30 @@ LoadTorrentParams SessionImpl::initLoadTorrentParams(const AddTorrentParams &add
@@ -2611,50 +2611,30 @@ LoadTorrentParams SessionImpl::initLoadTorrentParams(const AddTorrentParams &add
|
|
|
|
|
const auto defaultSavePath = suggestedSavePath(loadTorrentParams.category, addTorrentParams.useAutoTMM); |
|
|
|
|
const auto defaultDownloadPath = suggestedDownloadPath(loadTorrentParams.category, addTorrentParams.useAutoTMM); |
|
|
|
|
|
|
|
|
|
loadTorrentParams.useAutoTMM = addTorrentParams.useAutoTMM.value_or(!isAutoTMMDisabledByDefault()); |
|
|
|
|
loadTorrentParams.useAutoTMM = addTorrentParams.useAutoTMM.value_or( |
|
|
|
|
addTorrentParams.savePath.isEmpty() && addTorrentParams.downloadPath.isEmpty() && !isAutoTMMDisabledByDefault()); |
|
|
|
|
|
|
|
|
|
if (!addTorrentParams.useAutoTMM.has_value()) |
|
|
|
|
if (!loadTorrentParams.useAutoTMM) |
|
|
|
|
{ |
|
|
|
|
// Default TMM settings
|
|
|
|
|
|
|
|
|
|
if (!loadTorrentParams.useAutoTMM) |
|
|
|
|
{ |
|
|
|
|
loadTorrentParams.savePath = defaultSavePath; |
|
|
|
|
if (isDownloadPathEnabled()) |
|
|
|
|
loadTorrentParams.downloadPath = (!defaultDownloadPath.isEmpty() ? defaultDownloadPath : downloadPath()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
// Overridden TMM settings
|
|
|
|
|
if (addTorrentParams.savePath.isAbsolute()) |
|
|
|
|
loadTorrentParams.savePath = addTorrentParams.savePath; |
|
|
|
|
else |
|
|
|
|
loadTorrentParams.savePath = defaultSavePath / addTorrentParams.savePath; |
|
|
|
|
|
|
|
|
|
if (!loadTorrentParams.useAutoTMM) |
|
|
|
|
// if useDownloadPath isn't specified but downloadPath is explicitly set we prefer to use it
|
|
|
|
|
const bool useDownloadPath = addTorrentParams.useDownloadPath.value_or(!addTorrentParams.downloadPath.isEmpty() || isDownloadPathEnabled()); |
|
|
|
|
if (useDownloadPath) |
|
|
|
|
{ |
|
|
|
|
if (addTorrentParams.savePath.isAbsolute()) |
|
|
|
|
loadTorrentParams.savePath = addTorrentParams.savePath; |
|
|
|
|
else |
|
|
|
|
loadTorrentParams.savePath = defaultSavePath / addTorrentParams.savePath; |
|
|
|
|
// Overridden "Download path" settings
|
|
|
|
|
|
|
|
|
|
if (!addTorrentParams.useDownloadPath.has_value()) |
|
|
|
|
if (addTorrentParams.downloadPath.isAbsolute()) |
|
|
|
|
{ |
|
|
|
|
// Default "Download path" settings
|
|
|
|
|
|
|
|
|
|
if (isDownloadPathEnabled()) |
|
|
|
|
loadTorrentParams.downloadPath = (!defaultDownloadPath.isEmpty() ? defaultDownloadPath : downloadPath()); |
|
|
|
|
loadTorrentParams.downloadPath = addTorrentParams.downloadPath; |
|
|
|
|
} |
|
|
|
|
else if (addTorrentParams.useDownloadPath.value()) |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
// Overridden "Download path" settings
|
|
|
|
|
|
|
|
|
|
if (addTorrentParams.downloadPath.isAbsolute()) |
|
|
|
|
{ |
|
|
|
|
loadTorrentParams.downloadPath = addTorrentParams.downloadPath; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
const Path basePath = (!defaultDownloadPath.isEmpty() ? defaultDownloadPath : downloadPath()); |
|
|
|
|
loadTorrentParams.downloadPath = basePath / addTorrentParams.downloadPath; |
|
|
|
|
} |
|
|
|
|
const Path basePath = (!defaultDownloadPath.isEmpty() ? defaultDownloadPath : downloadPath()); |
|
|
|
|
loadTorrentParams.downloadPath = basePath / addTorrentParams.downloadPath; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|