aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/filesystem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zencore/filesystem.cpp')
-rw-r--r--src/zencore/filesystem.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/zencore/filesystem.cpp b/src/zencore/filesystem.cpp
index 7f341818b..8adb66972 100644
--- a/src/zencore/filesystem.cpp
+++ b/src/zencore/filesystem.cpp
@@ -2756,6 +2756,18 @@ GetEnvVariable(std::string_view VariableName)
return "";
}
+bool
+SetEnvVariable(std::string Name, std::string Value)
+{
+ ZEN_ASSERT(!Name.empty() && !Value.empty());
+#if ZEN_PLATFORM_WINDOWS
+ return SetEnvironmentVariableA(Name.c_str(), Value.c_str());
+#endif
+#if ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC
+ return setenv(Name.c_str(), Value.c_str(), /* overwrite */ 1) == 0;
+#endif
+}
+
std::error_code
RotateFiles(const std::filesystem::path& Filename, std::size_t MaxFiles)
{