mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-27 00:33:56 +00:00
21 lines
414 B
Odin
21 lines
414 B
Odin
#+private
|
|
#+build darwin, netbsd, freebsd, openbsd
|
|
package os
|
|
|
|
import "base:runtime"
|
|
|
|
@(require)
|
|
import "core:sys/posix"
|
|
|
|
_temp_dir :: proc(allocator: runtime.Allocator) -> (string, runtime.Allocator_Error) {
|
|
if tmp, ok := _lookup_env("TMPDIR", allocator); ok {
|
|
return tmp, nil
|
|
}
|
|
|
|
when #defined(posix.P_tmpdir) {
|
|
return clone_string(posix.P_tmpdir, allocator)
|
|
}
|
|
|
|
return clone_string("/tmp/", allocator)
|
|
}
|