mirror of
https://github.com/odin-lang/Odin.git
synced 2026-05-28 22:55:09 +00:00
19 lines
403 B
Odin
19 lines
403 B
Odin
#+private
|
|
package os
|
|
|
|
import "base:runtime"
|
|
|
|
import "core:sys/posix"
|
|
|
|
_posix_absolute_path :: proc(fd: posix.FD, name: string, allocator: runtime.Allocator) -> (path: cstring, err: Error) {
|
|
F_GETPATH :: 15
|
|
|
|
buf: [posix.PATH_MAX]byte
|
|
if posix.fcntl(fd, posix.FCNTL_Cmd(F_GETPATH), &buf) != 0 {
|
|
err = _get_platform_error()
|
|
return
|
|
}
|
|
|
|
return clone_to_cstring(string(cstring(&buf[0])), allocator)
|
|
}
|