Fix portable mode

This commit is contained in:
Andrew Rabert committed 2025-12-26 15:43:06 -05:00
1 parent c1c80a5fc4
commit ec3e4d101d
2 files changed
+7 -5

No files matched your search

+5 -3
View File
@@ -226,6 +226,9 @@ int main(int argc, char *argv[])
// Now parse the command line.
parser.process(arguments);
// Detect portable mode while QCoreApplication exists (needed for applicationDirPath)
Paths::detectAndEnablePortableMode();
}
if (parser.isSet("help"))
@@ -243,10 +246,9 @@ int main(int argc, char *argv[])
return EXIT_SUCCESS;
}
// Check for portable mode (marker file next to exe)
if (Paths::detectAndEnablePortableMode())
// Set QSettings path for portable mode
if (Paths::isPortableMode())
{
// Portable mode sets its own paths, skip config-dir
QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope,
Paths::globalDataDir());
}
+2 -2
View File
@@ -7,8 +7,8 @@
#include <QDir>
#include <QStandardPaths>
#include <QCoreApplication>
#include <QGuiApplication>
#include <QtGui/qguiapplication.h>
#include <QDebug>
#include "Names.h"
#include "Version.h"
@@ -41,7 +41,7 @@ bool Paths::isPortableMode()
bool Paths::detectAndEnablePortableMode()
{
#ifdef Q_OS_WIN
QString appDir = QGuiApplication::applicationDirPath();
QString appDir = QCoreApplication::applicationDirPath();
// Check for portable marker file
if (QFile::exists(appDir + "/portable") || QFile::exists(appDir + "/portable.txt"))