diff options
author | saturneric <[email protected]> | 2025-01-21 22:59:35 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2025-01-21 22:59:35 +0000 |
commit | 56140c6bdc567bf85c5916a36d707196a52b9272 (patch) | |
tree | 32c216f1ac572649d44568dd886130ac0503114e /src | |
parent | feat: enhance key db functions (diff) | |
download | GpgFrontend-56140c6bdc567bf85c5916a36d707196a52b9272.tar.gz GpgFrontend-56140c6bdc567bf85c5916a36d707196a52b9272.zip |
fix: make app fully portable
Diffstat (limited to 'src')
-rw-r--r-- | src/core/GpgCoreInit.cpp | 4 | ||||
-rw-r--r-- | src/core/function/GlobalSettingStation.cpp | 1 | ||||
-rw-r--r-- | src/core/utils/GpgUtils.cpp | 9 |
3 files changed, 11 insertions, 3 deletions
diff --git a/src/core/GpgCoreInit.cpp b/src/core/GpgCoreInit.cpp index 1b987bc3..5c535319 100644 --- a/src/core/GpgCoreInit.cpp +++ b/src/core/GpgCoreInit.cpp @@ -67,7 +67,7 @@ auto SearchGpgconfPath(const QList<QString>& candidate_paths) -> QString { auto GetDefaultKeyDatabasePath(const QString& gpgconf_path) -> QString { // portable mode if (GlobalSettingStation::GetInstance().IsProtableMode()) { - return GlobalSettingStation::GetInstance().GetAppDataPath(); + return GlobalSettingStation::GetInstance().GetAppDataPath() + "/db"; } if (gpgconf_path.isEmpty()) return {}; @@ -402,6 +402,8 @@ auto InitBasicPath() -> bool { return false; } + if (!QDir(default_home_path).exists()) QDir(default_home_path).mkpath("."); + RefreshGpgMEBackendEngine(target_gpgconf_path, target_gnupg_path, default_home_path); diff --git a/src/core/function/GlobalSettingStation.cpp b/src/core/function/GlobalSettingStation.cpp index b0a2182c..d57f8b3e 100644 --- a/src/core/function/GlobalSettingStation.cpp +++ b/src/core/function/GlobalSettingStation.cpp @@ -74,6 +74,7 @@ class GlobalSettingStation::Impl { #if defined(_WIN32) || defined(WIN32) return QSettings(app_config_file_path(), QSettings::IniFormat); #else + if (IsProtableMode()) return {app_config_file_path(), QSettings::IniFormat}; return QSettings(); #endif } diff --git a/src/core/utils/GpgUtils.cpp b/src/core/utils/GpgUtils.cpp index 38eef081..c4478f6f 100644 --- a/src/core/utils/GpgUtils.cpp +++ b/src/core/utils/GpgUtils.cpp @@ -230,12 +230,17 @@ auto GetKeyDatabasesBySettings() -> QContainer<KeyDatabaseItemSO> { if (key_dbs.empty()) { KeyDatabaseItemSO key_db; - auto default_home_path = Module::RetrieveRTValueTypedOrDefault<>( + auto home_path = Module::RetrieveRTValueTypedOrDefault<>( "core", "gpgme.ctx.default_database_path", QString{}); + if (GlobalSettingStation::GetInstance().IsProtableMode()) { + home_path = QDir(GlobalSettingStation::GetInstance().GetAppDir()) + .relativeFilePath(home_path); + } + key_db.channel = 0; key_db.name = "DEFAULT"; - key_db.path = default_home_path; + key_db.path = home_path; key_dbs.append(key_db); } |