diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2025-08-29 11:16:11 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-29 11:16:11 +0200 |
| commit | 790e544689e7f7a906ee291a6715bc6833b15606 (patch) | |
| tree | 448cf76b6d727f4db3526494ce4fc5914c1663ed /src/config/ConfigManager.cpp | |
| parent | a209f9911ceb83e17a3fc0269ebea1a7d8587784 (diff) | |
config: update environment if cfg changes live (#11508)
Diffstat (limited to 'src/config/ConfigManager.cpp')
| -rw-r--r-- | src/config/ConfigManager.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 27f3b5d5..3e75f2ab 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -3107,14 +3107,18 @@ std::optional<std::string> CConfigManager::handleSource(const std::string& comma } std::optional<std::string> CConfigManager::handleEnv(const std::string& command, const std::string& value) { - if (!m_isFirstLaunch) - return {}; - const auto ARGS = CVarList(value, 2); if (ARGS[0].empty()) return "env empty"; + if (!m_isFirstLaunch) { + // check if env changed at all. If it didn't, ignore. If it did, update it. + const auto* ENV = getenv(ARGS[0].c_str()); + if (ENV && ENV == ARGS[1]) + return {}; // env hasn't changed + } + setenv(ARGS[0].c_str(), ARGS[1].c_str(), 1); if (command.back() == 'd') { |
