Allow add torrents with relative save path

The relative save path will be resoloved against the default one.
This commit is contained in:
Vladimir Golovnev (Glassez) 2021-05-05 16:56:31 +03:00
parent a51742b47c
commit 89cedd411e
No known key found for this signature in database
GPG Key ID: 52A2C7DEE2DFA6F7

View File

@ -2062,8 +2062,10 @@ LoadTorrentParams Session::initLoadTorrentParams(const AddTorrentParams &addTorr
const bool useAutoTMM = addTorrentParams.useAutoTMM.value_or(!isAutoTMMDisabledByDefault());
if (useAutoTMM)
loadTorrentParams.savePath = "";
else if (addTorrentParams.savePath.trimmed().isEmpty())
else if (addTorrentParams.savePath.isEmpty())
loadTorrentParams.savePath = defaultSavePath();
else if (QDir(addTorrentParams.savePath).isRelative())
loadTorrentParams.savePath = QDir(defaultSavePath()).absoluteFilePath(addTorrentParams.savePath);
else
loadTorrentParams.savePath = normalizePath(addTorrentParams.savePath);