diff options
author | saturneric <[email protected]> | 2025-04-17 19:59:01 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2025-04-17 19:59:01 +0000 |
commit | 92be7f8da6076311b996a184c76781c07608cc9f (patch) | |
tree | 1088b3f5ad7c086e7f462287c14624e2202adbf0 /src/core/utils/GpgUtils.cpp | |
parent | feat: check scd version (diff) | |
download | GpgFrontend-92be7f8da6076311b996a184c76781c07608cc9f.tar.gz GpgFrontend-92be7f8da6076311b996a184c76781c07608cc9f.zip |
fix: issues found on linux platform
Diffstat (limited to 'src/core/utils/GpgUtils.cpp')
-rw-r--r-- | src/core/utils/GpgUtils.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/core/utils/GpgUtils.cpp b/src/core/utils/GpgUtils.cpp index ad93fe67..b8824673 100644 --- a/src/core/utils/GpgUtils.cpp +++ b/src/core/utils/GpgUtils.cpp @@ -289,7 +289,13 @@ auto GetCanonicalKeyDatabasePath(const QDir& app_path, << "to absolute path: " << target_path; } - auto info = QFileInfo(target_path); + QFileInfo info(target_path); + if (!info.exists()) { + LOG_W() << "key database not exists:" << info.canonicalFilePath() + << ", making a new directory..."; + QDir().mkdir(info.canonicalFilePath()); + } + if (VerifyKeyDatabasePath(info)) { auto key_database_fs_path = info.canonicalFilePath(); LOG_D() << "load gpg key database:" << key_database_fs_path; @@ -310,10 +316,18 @@ auto GetKeyDatabaseInfoBySettings() -> QContainer<KeyDatabaseInfo> { // try to use user defined key database for (const auto& key_database : key_dbs) { + if (key_database.path.isEmpty()) continue; + + LOG_D() << "got key database:" << key_database.path; + auto key_database_fs_path = GetCanonicalKeyDatabasePath(app_path, key_database.path); - if (key_database_fs_path.isEmpty()) continue; + if (key_database_fs_path.isEmpty()) { + LOG_E() << "cannot use target path" << key_database.path + << "as key database"; + continue; + } KeyDatabaseInfo key_db_info; key_db_info.name = key_database.name; |