From 1913c08b7bc5017f1abb771590782d0b63a7cfbe Mon Sep 17 00:00:00 2001 From: Roland Kovacs Date: Tue, 30 Jul 2024 18:09:51 +0200 Subject: [PATCH] [os2] Add missing temp_file implementation for Linux --- core/os/os2/temp_file_linux.odin | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/os/os2/temp_file_linux.odin b/core/os/os2/temp_file_linux.odin index 92afcde47..d6f90fbaf 100644 --- a/core/os/os2/temp_file_linux.odin +++ b/core/os/os2/temp_file_linux.odin @@ -3,8 +3,11 @@ package os2 import "base:runtime" - -_temp_dir :: proc(allocator: runtime.Allocator) -> (string, Error) { - //TODO - return "", nil +_temp_dir :: proc(allocator: runtime.Allocator) -> (string, runtime.Allocator_Error) { + TEMP_ALLOCATOR_GUARD() + tmpdir := get_env("TMPDIR", temp_allocator()) + if tmpdir == "" { + tmpdir = "/tmp" + } + return clone_string(tmpdir, allocator) }