file_posix_other.odin 451 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_GUARD()
  8. cname := temp_cstring(name)
  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. }