diff options
author | Saturn&Eric <[email protected]> | 2023-04-04 19:25:40 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2023-04-04 19:25:40 +0000 |
commit | 770e0d6ab61ec9ade91f1109244043195d99b720 (patch) | |
tree | c9605d79f53468176225d2c9314fceb0e036791e /src/init.cpp | |
parent | Merge pull request #93 from saturneric/dev/2.0.10/main (diff) | |
parent | feat: upgrade version to 2.1.1 (diff) | |
download | GpgFrontend-770e0d6ab61ec9ade91f1109244043195d99b720.tar.gz GpgFrontend-770e0d6ab61ec9ade91f1109244043195d99b720.zip |
Merge pull request #95 from saturneric/dev/2.1.0/main
Develop 2.1.1.1
Diffstat (limited to 'src/init.cpp')
-rw-r--r-- | src/init.cpp | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/src/init.cpp b/src/init.cpp index 80c34800..955b8a55 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -38,15 +38,14 @@ #include "core/function/GlobalSettingStation.h" #ifdef WINDOWS -int setenv(const char *name, const char *value, int overwrite) -{ - if(!overwrite) { - int errcode = 0; - size_t envsize = 0; - errcode = getenv_s(&envsize, NULL, 0, name); - if(errcode || envsize) return errcode; - } - return _putenv_s(name, value); +int setenv(const char *name, const char *value, int overwrite) { + if (!overwrite) { + int errcode = 0; + size_t envsize = 0; + errcode = getenv_s(&envsize, NULL, 0, name); + if (errcode || envsize) return errcode; + } + return _putenv_s(name, value); } #endif @@ -91,7 +90,7 @@ void shutdown_logging_system() { } void init_global_path_env() { - auto& settings = + auto &settings = GpgFrontend::GlobalSettingStation::GetInstance().GetUISettings(); bool use_custom_gnupg_install_path = false; @@ -115,14 +114,13 @@ void init_global_path_env() { // add custom gnupg install path into env $PATH if (use_custom_gnupg_install_path && !custom_gnupg_install_path.empty()) { std::string path_value = getenv("PATH"); - SPDLOG_DEBUG("PATH: {}", path_value); - setenv( - "PATH", - ((std::filesystem::path{custom_gnupg_install_path} / "bin").u8string() + - ":" + path_value) - .c_str(), - 1); + SPDLOG_DEBUG("Current System PATH: {}", path_value); + setenv("PATH", + ((std::filesystem::path{custom_gnupg_install_path}).u8string() + + ":" + path_value) + .c_str(), + 1); std::string modified_path_value = getenv("PATH"); - SPDLOG_DEBUG("Modified PATH: {}", modified_path_value); + SPDLOG_DEBUG("Modified System PATH: {}", modified_path_value); } } |