diff options
author | Saturneric <[email protected]> | 2023-02-06 13:22:24 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2023-02-06 13:22:24 +0000 |
commit | 78607d9d1bd8f2feebe5d67e82ba033cb012ae4c (patch) | |
tree | f3b1d8a8972294fd54c346692e2ebc3a182d226f /src/main.cpp | |
parent | fix: sovle a compile issue in macOS (diff) | |
download | GpgFrontend-78607d9d1bd8f2feebe5d67e82ba033cb012ae4c.tar.gz GpgFrontend-78607d9d1bd8f2feebe5d67e82ba033cb012ae4c.zip |
feat: support buddled gnupg for posix platform
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index 36c3c7e9..52a20334 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,9 +33,13 @@ #include <csetjmp> #include <csignal> #include <cstddef> +#include <cstdlib> +#include <string> #include "core/GpgConstants.h" #include "core/GpgCoreInit.h" +#include "core/function/GlobalSettingStation.h" +#include "spdlog/spdlog.h" #include "ui/GpgFrontendApplication.h" #include "ui/GpgFrontendUIInit.h" @@ -93,12 +97,27 @@ int main(int argc, char* argv[]) { auto* app = GpgFrontend::UI::GpgFrontendApplication::GetInstance(argc, argv, true); - // init the logging system + // init the logging system for main init_logging_system(); // init the logging system for core GpgFrontend::InitLoggingSystem(); + // change path to search for related + std::string path_value = getenv("PATH"); + SPDLOG_DEBUG("PATH: {}", path_value); + setenv("PATH", + ((GpgFrontend::GlobalSettingStation::GetInstance() + .GetAppDir() + .parent_path() / + "GnuPG" / "bin") + .u8string() + + ":" + path_value) + .c_str(), + 1); + std::string modified_path_value = getenv("PATH"); + SPDLOG_DEBUG("Modified PATH: {}", modified_path_value); + /** * internationalisation. loop to restart main window * with changed translation when settings change. @@ -132,16 +151,22 @@ int main(int argc, char* argv[]) { return_from_event_loop_code = CRASH_CODE; } - SPDLOG_INFO("loop refresh"); + SPDLOG_INFO("restart loop refresh"); } while (return_from_event_loop_code == RESTART_CODE); // reset core GpgFrontend::ResetGpgFrontendCore(); + // log for debug + SPDLOG_INFO("deep restart or cash loop refresh"); + // deep restart mode } while (return_from_event_loop_code == DEEP_RESTART_CODE || return_from_event_loop_code == CRASH_CODE); + // log for debug + SPDLOG_INFO("GpgFrontend about to exit"); + // exit the program return return_from_event_loop_code; } |