file_posix_other.odin 500 B

123456789101112131415161718192021
  1. #+private
  2. #+build openbsd
  3. package os2
  4. import "base:runtime"
  5. import "core:sys/posix"
  6. _posix_absolute_path :: proc(fd: posix.FD, name: string, allocator: runtime.Allocator) -> (path: cstring, err: Error) {
  7. temp_allocator := TEMP_ALLOCATOR_GUARD({ allocator })
  8. cname := clone_to_cstring(name, temp_allocator)
  9. buf: [posix.PATH_MAX]byte
  10. path = posix.realpath(cname, raw_data(buf[:]))
  11. if path == nil {
  12. err = _get_platform_error()
  13. return
  14. }
  15. return clone_to_cstring(string(path), allocator)
  16. }