From 4e6790dfbbf9c2624b23cbfb7a525b5f4fbfa56d Mon Sep 17 00:00:00 2001 From: "Vladimir Golovnev (Glassez)" Date: Tue, 31 Mar 2020 14:48:58 +0300 Subject: [PATCH] Prevent multiple instances for the same app config --- src/app/application.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/application.cpp b/src/app/application.cpp index db99b3e5a..844b7118d 100644 --- a/src/app/application.cpp +++ b/src/app/application.cpp @@ -149,8 +149,12 @@ Application::Application(int &argc, char **argv) const QString profileDir = portableModeEnabled ? QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(DEFAULT_PORTABLE_MODE_PROFILE_DIR) : m_commandLineArgs.profileDir; - const QString appId = QLatin1String("qBittorrent-") + Utils::Misc::getUserIDString() + '@' + profileDir - + (m_commandLineArgs.configurationName.isEmpty() ? QString {} : ('/' + m_commandLineArgs.configurationName)); +#ifdef Q_OS_WIN + const QString instanceId = (profileDir + (m_commandLineArgs.configurationName.isEmpty() ? QString {} : ('/' + m_commandLineArgs.configurationName))).toLower(); +#else + const QString instanceId = profileDir + (m_commandLineArgs.configurationName.isEmpty() ? QString {} : ('/' + m_commandLineArgs.configurationName)); +#endif + const QString appId = QLatin1String("qBittorrent-") + Utils::Misc::getUserIDString() + '@' + instanceId; m_instanceManager = new ApplicationInstanceManager {appId, this}; Profile::initInstance(profileDir, m_commandLineArgs.configurationName,