Skip to content

Commit

Permalink
Merge pull request #4672 from shizeeg/master
Browse files Browse the repository at this point in the history
add os.exists() to FreeBSD
  • Loading branch information
laytan authored Jan 11, 2025
2 parents 896319d + 509da8e commit cd93e2f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/os/os_freebsd.odin
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,14 @@ is_dir_path :: proc(path: string, follow_links: bool = true) -> bool {
is_file :: proc {is_file_path, is_file_handle}
is_dir :: proc {is_dir_path, is_dir_handle}

@(require_results)
exists :: proc(path: string) -> bool {
runtime.DEFAULT_TEMP_ALLOCATOR_TEMP_GUARD()
cpath := strings.clone_to_cstring(path, context.temp_allocator)
res := _unix_access(cpath, O_RDONLY)
return res == 0
}

// NOTE(bill): Uses startup to initialize it

stdin: Handle = 0
Expand Down

0 comments on commit cd93e2f

Please sign in to comment.