Files
Odin/core/os/os2/path_darwin.odin
2025-01-22 18:40:06 +01:00

18 lines
415 B
Odin

package os2
import "base:runtime"
import "core:sys/darwin"
import "core:sys/posix"
_get_executable_path :: proc(allocator: runtime.Allocator) -> (path: string, err: Error) {
buffer: [darwin.PIDPATHINFO_MAXSIZE]byte = ---
ret := darwin.proc_pidpath(posix.getpid(), raw_data(buffer[:]), len(buffer))
if ret > 0 {
return clone_string(string(buffer[:ret]), allocator)
}
err = _get_platform_error()
return
}