aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTetralux <tetraluxonpc@gmail.com>2022-05-17 03:11:55 +0000
committerTetralux <tetraluxonpc@gmail.com>2022-05-18 07:12:30 +0000
commit57167be2a613b4ef01c8fbe6d292d7f38085e78e (patch)
tree20732602a4da3ae1078edb0962c57582ff0f8e60
parent0cc67ff5e348aa2811b0dd3fa81805b9ce93ea4f (diff)
[os] Linux: os.unset_env()
-rw-r--r--core/os/os_linux.odin9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/os/os_linux.odin b/core/os/os_linux.odin
index e4ce37567..de3a22187 100644
--- a/core/os/os_linux.odin
+++ b/core/os/os_linux.odin
@@ -794,6 +794,15 @@ set_env :: proc(key, value: string) -> Errno {
return ERROR_NONE
}
+unset_env :: proc(key: string) -> Errno {
+ s := strings.clone_to_cstring(key, context.temp_allocator)
+ res := _unix_putenv(s)
+ if res < 0 {
+ return Errno(get_last_error())
+ }
+ return ERROR_NONE
+}
+
get_current_directory :: proc() -> string {
// NOTE(tetra): I would use PATH_MAX here, but I was not able to find
// an authoritative value for it across all systems.