diff options
author | Saturneric <[email protected]> | 2021-12-20 08:17:34 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-12-20 09:40:32 +0000 |
commit | 5fb0f8b0fc46d2413dbcde3f118570245e2ee154 (patch) | |
tree | 216ed80867dce37ca8bf3a593facc4eff15d1280 /src | |
parent | Fixed bugs. (diff) | |
download | GpgFrontend-5fb0f8b0fc46d2413dbcde3f118570245e2ee154.tar.gz GpgFrontend-5fb0f8b0fc46d2413dbcde3f118570245e2ee154.zip |
Update Test Code & Added Standlone Support
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/gpg/GpgContext.cpp | 10 | ||||
-rw-r--r-- | src/gpg/GpgContext.h | 3 |
3 files changed, 14 insertions, 2 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f7dd86eb..fc7d8169 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -124,6 +124,9 @@ endif () if (APPLICATION_BUILD) if (${CMAKE_BUILD_TYPE} STREQUAL "Release") if (APPLE) + if(APPLE_SANDBOX) + file(COPY ${CMAKE_SOURCE_DIR}/resource/gpg1.4 DESTINATION ${RESOURCE_OUTPUT_DIRECTORY}/ FOLLOW_SYMLINK_CHAIN) + endif() file(COPY ${CMAKE_SOURCE_DIR}/gpgfrontend.icns DESTINATION ${RESOURCE_OUTPUT_DIRECTORY}/ FOLLOW_SYMLINK_CHAIN) # Refresh App Bundle file(REMOVE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${AppName}.app) diff --git a/src/gpg/GpgContext.cpp b/src/gpg/GpgContext.cpp index a8b86619..d2b500e2 100644 --- a/src/gpg/GpgContext.cpp +++ b/src/gpg/GpgContext.cpp @@ -45,7 +45,7 @@ namespace GpgFrontend { * Set up gpgme-context, set paths to app-run path */ GpgContext::GpgContext(bool independent_database, std::string db_path, - int channel) + bool gpg_alone, std::string gpg_path, int channel) : SingletonFunctionObject<GpgContext>(channel) { static bool _first = true; @@ -64,6 +64,14 @@ GpgContext::GpgContext(bool independent_database, std::string db_path, check_gpg_error(gpgme_new(&_p_ctx)); _ctx_ref = CtxRefHandler(_p_ctx); + if (gpg_alone) { + info.AppPath = gpg_path; + auto err = gpgme_ctx_set_engine_info(_ctx_ref.get(), GPGME_PROTOCOL_OpenPGP, + info.AppPath.c_str(), + info.DatabasePath.c_str()); + assert(check_gpg_error_2_err_code(err) == GPG_ERR_NO_ERROR); + } + auto engineInfo = gpgme_ctx_get_engine_info(*this); // Check ENV before running diff --git a/src/gpg/GpgContext.h b/src/gpg/GpgContext.h index 5812f49f..da19bfd9 100644 --- a/src/gpg/GpgContext.h +++ b/src/gpg/GpgContext.h @@ -38,7 +38,8 @@ namespace GpgFrontend { class GpgContext : public SingletonFunctionObject<GpgContext> { public: explicit GpgContext(bool independent_database = false, - std::string path = std::string(), int channel = 0); + std::string path = std::string(), bool gpg_alone = false, + std::string gpg_path = std::string(), int channel = 0); ~GpgContext() override = default; |