diff options
author | Jonathan White <support@dmapps.us> | 2022-09-07 04:51:20 +0300 |
---|---|---|
committer | Jonathan White <support@dmapps.us> | 2022-09-07 04:51:20 +0300 |
commit | 6f405f0af7089a01c1e8c1ad18c78ce43dfcc2fa (patch) | |
tree | 72aad0ca7e98b8524f49c33e19af4815df4c18af | |
parent | bdeef63fe4147e71f2f6bf387468a8c54312ee19 (diff) |
Check for write permission before entering portable modefix/portable-check
* Fix #7585
-rw-r--r-- | src/core/Config.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/core/Config.cpp b/src/core/Config.cpp index 3c20ff80d..78dae00db 100644 --- a/src/core/Config.cpp +++ b/src/core/Config.cpp @@ -481,8 +481,15 @@ void Config::init(const QString& configFileName, const QString& localConfigFileN QPair<QString, QString> Config::defaultConfigFiles() { // Check if we are running in portable mode, if so store the config files local to the app + // Enable QFileInfo::isWritable check on Windows + extern Q_CORE_EXPORT int qt_ntfs_permission_lookup; + qt_ntfs_permission_lookup++; auto portablePath = QCoreApplication::applicationDirPath().append("/%1"); - if (QFile::exists(portablePath.arg(".portable"))) { + auto portableFile = portablePath.arg(".portable"); + bool isPortable = QFile::exists(portableFile) && QFileInfo(portableFile).isWritable(); + qt_ntfs_permission_lookup--; + + if (isPortable) { return {portablePath.arg("config/keepassxc.ini"), portablePath.arg("config/keepassxc_local.ini")}; } |