diff options
author | Saturneric <[email protected]> | 2023-04-04 16:19:58 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2023-04-04 16:19:58 +0000 |
commit | c71d1ab50b42afe6ba0c77a9038d4ef3c8139a63 (patch) | |
tree | f2c0d77a08ce794d64ca4e75f809d9452006a03b /src/init.cpp | |
parent | feat: add gnupg controller (diff) | |
download | GpgFrontend-c71d1ab50b42afe6ba0c77a9038d4ef3c8139a63.tar.gz GpgFrontend-c71d1ab50b42afe6ba0c77a9038d4ef3c8139a63.zip |
feat: improve init progress
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); } } |