/*** Copyright (C) 2023 J Reece Wilson (a/k/a "Reece"). All rights reserved. File: AuProcessEnvironment.cpp Date: 2023-7-10 Author: Reece ***/ #include #include "AuProcessEnvironment.hpp" namespace Aurora::Process { AUKN_SYM bool EnvironmentRemoveMany(const AuList &list) { bool bFailed {}; for (const auto &key : list) { if (!EnvironmentRemoveOne(key)) { bFailed |= true; } } return !bFailed; } AUKN_SYM bool EnvironmentSetMany(const AuList> &list) { for (const auto &[key, value] : list) { if (!EnvironmentSetOne(key, value)) { return false; } } return true; } AuOptional> EnvironmentSplitString(const AuString &str) { auto uIdx = str.find('='); if (uIdx == str.npos) { return {}; } if (uIdx == 0) { // Ignore Microsoft DOS shell environment hints // Expect to see: // =::=::\ // (opt) =:= // (opt) =ExitCode={:08x} return {}; } return AuMakePair(str.substr(0, uIdx), str.substr(uIdx + 1)); } }