diff options
author | saturneric <[email protected]> | 2025-04-18 17:35:45 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2025-04-18 17:35:45 +0000 |
commit | d115562e6cb231356ef87a2ab86f4da1159a9e41 (patch) | |
tree | c079dd49cf0a991b17cb96ad4f05d558567908c0 /src/core | |
parent | feat: add more basic env checks at init (diff) | |
download | GpgFrontend-d115562e6cb231356ef87a2ab86f4da1159a9e41.tar.gz GpgFrontend-d115562e6cb231356ef87a2ab86f4da1159a9e41.zip |
fix: issues found on macos
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/GpgCoreInit.cpp | 11 | ||||
-rw-r--r-- | src/core/function/gpg/GpgContext.cpp | 4 | ||||
-rw-r--r-- | src/core/utils/GpgUtils.cpp | 2 |
3 files changed, 10 insertions, 7 deletions
diff --git a/src/core/GpgCoreInit.cpp b/src/core/GpgCoreInit.cpp index 1735c316..561c3e24 100644 --- a/src/core/GpgCoreInit.cpp +++ b/src/core/GpgCoreInit.cpp @@ -429,10 +429,6 @@ void EnsureGpgAgentConfHasPinentry(GpgContext& ctx) { } config_file.close(); LOG_D() << "updated gpg-agent.conf with pinentry:" << pinentry_path; - - // reload configure - GpgAdvancedOperator::GetInstance(ctx.GetChannel()) - .ReloadAllGpgComponents(); } else { LOG_W() << "failed to write to gpg-agent.conf"; } @@ -612,7 +608,8 @@ auto InitGpgFrontendCore(CoreInitArgs args) -> int { return -1; } -#if defined(__linux__) +#if !(defined(_WIN32) || defined(WIN32)) + // auto config pinentry-program EnsureGpgAgentConfHasPinentry(default_ctx); #endif @@ -669,6 +666,10 @@ auto InitGpgFrontendCore(CoreInitArgs args) -> int { EnsureGpgAgentConfHasPinentry(ctx); #endif +#if defined(__APPLE__) && defined(__MACH__) + EnsureGpgAgentConfHasPinentry(ctx); +#endif + if (!GpgKeyGetter::GetInstance(ctx.GetChannel()).FlushKeyCache()) { LOG_E() << "gpgme context init key cache failed, index:" << channel_index; diff --git a/src/core/function/gpg/GpgContext.cpp b/src/core/function/gpg/GpgContext.cpp index de450356..ca00c452 100644 --- a/src/core/function/gpg/GpgContext.cpp +++ b/src/core/function/gpg/GpgContext.cpp @@ -43,7 +43,7 @@ #include "core/utils/GpgUtils.h" #include "core/utils/MemoryUtils.h" -#ifdef _WIN32 +#if defined(_WIN32) || defined(WIN32) #include <windows.h> #endif @@ -408,7 +408,7 @@ class GpgContext::Impl { auto configuration_name = info_split_list[0].trimmed(); auto configuration_value = info_split_list[1].trimmed(); -#ifdef __MINGW32__ +#if defined(_WIN32) || defined(WIN32) // replace some special substrings on windows // platform configuration_value.replace("%3a", ":"); diff --git a/src/core/utils/GpgUtils.cpp b/src/core/utils/GpgUtils.cpp index 8b2abeb7..d8f147bb 100644 --- a/src/core/utils/GpgUtils.cpp +++ b/src/core/utils/GpgUtils.cpp @@ -462,6 +462,8 @@ auto GPGFRONTEND_CORE_EXPORT DecidePinentry() -> QString { QStringList preferred_list = {"pinentry-gnome3", "pinentry-qt" "pinentry-gtk2"}; +#elif defined(__APPLE__) && defined(__MACH__) + QStringList preferred_list = {"pinentry-mac", "pinentry-qt"}; #else QStringList preferred_list = {"pinentry-qt"}; #endif |