Fix portable mode detection for native messaging files

* Fixes #10755
This commit is contained in:
Jonathan White 2024-05-26 10:19:10 -04:00
parent 2a62000b28
commit 1fd8923746
3 changed files with 28 additions and 16 deletions

View file

@ -19,6 +19,7 @@
#include "NativeMessageInstaller.h"
#include "BrowserSettings.h"
#include "config-keepassx.h"
#include "core/Config.h"
#include <QCoreApplication>
#include <QDebug>
@ -209,8 +210,8 @@ QString NativeMessageInstaller::getNativeMessagePath(SupportedBrowsers browser)
QString basePath;
#if defined(Q_OS_WIN)
// If portable settings file exists save the JSON scripts to the application folder
if (QFile::exists(QCoreApplication::applicationDirPath() + QStringLiteral("/keepassxc.ini"))) {
basePath = QCoreApplication::applicationDirPath();
if (Config::isPortable()) {
basePath = Config::portableConfigDir();
} else {
basePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
}