config: update environment if cfg changes live (#11508)
This commit is contained in:
parent
a209f9911c
commit
790e544689
1 changed files with 7 additions and 3 deletions
|
|
@ -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') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue