diff --git a/src/app/cmdoptions.cpp b/src/app/cmdoptions.cpp index 21820c85e..582426044 100644 --- a/src/app/cmdoptions.cpp +++ b/src/app/cmdoptions.cpp @@ -42,6 +42,7 @@ #endif #include "base/global.h" +#include "base/utils/fs.h" #include "base/utils/misc.h" #include "base/utils/string.h" @@ -336,7 +337,7 @@ QBtCommandLineParameters::QBtCommandLineParameters(const QProcessEnvironment &en , webUIPort(WEBUI_PORT_OPTION.value(env, -1)) , torrentingPort(TORRENTING_PORT_OPTION.value(env, -1)) , skipDialog(SKIP_DIALOG_OPTION.value(env)) - , profileDir(PROFILE_OPTION.value(env)) + , profileDir(Utils::Fs::toAbsolutePath(Path(PROFILE_OPTION.value(env)))) , configurationName(CONFIGURATION_OPTION.value(env)) { addTorrentParams.savePath = Path(SAVE_PATH_OPTION.value(env)); @@ -402,7 +403,7 @@ QBtCommandLineParameters parseCommandLine(const QStringList &args) #endif else if (arg == PROFILE_OPTION) { - result.profileDir = Path(PROFILE_OPTION.value(arg)); + result.profileDir = Utils::Fs::toAbsolutePath(Path(PROFILE_OPTION.value(arg))); } else if (arg == RELATIVE_FASTRESUME) { diff --git a/src/base/utils/fs.cpp b/src/base/utils/fs.cpp index f52b17ec6..928d07d1d 100644 --- a/src/base/utils/fs.cpp +++ b/src/base/utils/fs.cpp @@ -345,6 +345,11 @@ bool Utils::Fs::isDir(const Path &path) return QFileInfo(path.data()).isDir(); } +Path Utils::Fs::toAbsolutePath(const Path &path) +{ + return Path(QFileInfo(path.data()).absoluteFilePath()); +} + Path Utils::Fs::toCanonicalPath(const Path &path) { return Path(QFileInfo(path.data()).canonicalFilePath()); diff --git a/src/base/utils/fs.h b/src/base/utils/fs.h index 22ad45041..3dccb1d2d 100644 --- a/src/base/utils/fs.h +++ b/src/base/utils/fs.h @@ -55,6 +55,7 @@ namespace Utils::Fs QString toValidFileName(const QString &name, const QString &pad = u" "_s); Path toValidPath(const QString &name, const QString &pad = u" "_s); + Path toAbsolutePath(const Path &path); Path toCanonicalPath(const Path &path); bool copyFile(const Path &from, const Path &to);