blob: a72dc2fab3600159c0a62ecf675251603b4ac46d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#+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)
}
|