Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan White <support@dmapps.us>2022-09-07 04:51:20 +0300
committerJonathan White <support@dmapps.us>2022-09-07 14:06:23 +0300
commit61f922179b8ef1446cc85385e391c83f86f204ce (patch)
treeb60cb43499aa2fe15a900944f71efd2ba80b30cf
parent9e81c31e5a5f262662cb448f92ac0aafdae97698 (diff)
Check for write permission before entering portable mode
* Fix #7585
-rw-r--r--src/core/Config.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/Config.cpp b/src/core/Config.cpp
index 3c20ff80d..8808abd75 100644
--- a/src/core/Config.cpp
+++ b/src/core/Config.cpp
@@ -481,8 +481,19 @@ 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
+#ifdef Q_OS_WIN
+ // Enable QFileInfo::isWritable check on Windows
+ extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
+ qt_ntfs_permission_lookup++;
+#endif
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();
+#ifdef Q_OS_WIN
+ qt_ntfs_permission_lookup--;
+#endif
+
+ if (isPortable) {
return {portablePath.arg("config/keepassxc.ini"), portablePath.arg("config/keepassxc_local.ini")};
}