diff options
| author | Laytan <laytanlaats@hotmail.com> | 2025-01-11 01:03:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-11 01:03:36 +0100 |
| commit | cd93e2f6f8bb971e1d33bfc783ce4ab4e7568a5b (patch) | |
| tree | e15ab6e9eb5c9fe4d062bf57caf6e4f1776ee92f /core/os | |
| parent | 896319d0d503ae613510d4f8a5374b8ee0b4a2a3 (diff) | |
| parent | 509da8e63234c5d30082301d5054f9441a7d0912 (diff) | |
Merge pull request #4672 from shizeeg/master
add os.exists() to FreeBSD
Diffstat (limited to 'core/os')
| -rw-r--r-- | core/os/os_freebsd.odin | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/os/os_freebsd.odin b/core/os/os_freebsd.odin index 837e79f4d..87a56b057 100644 --- a/core/os/os_freebsd.odin +++ b/core/os/os_freebsd.odin @@ -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 |