mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
[os] Darwin: Add os.exists()
This commit is contained in:
@@ -473,6 +473,11 @@ is_dir_path :: proc(path: string, follow_links: bool = true) -> bool {
|
|||||||
is_file :: proc {is_file_path, is_file_handle}
|
is_file :: proc {is_file_path, is_file_handle}
|
||||||
is_dir :: proc {is_dir_path, is_dir_handle}
|
is_dir :: proc {is_dir_path, is_dir_handle}
|
||||||
|
|
||||||
|
exists :: proc(path: string) -> bool {
|
||||||
|
cpath := strings.clone_to_cstring(path, context.temp_allocator)
|
||||||
|
res := _unix_access(cpath, O_RDONLY)
|
||||||
|
return res == 0
|
||||||
|
}
|
||||||
|
|
||||||
rename :: proc(old: string, new: string) -> bool {
|
rename :: proc(old: string, new: string) -> bool {
|
||||||
old_cstr := strings.clone_to_cstring(old, context.temp_allocator)
|
old_cstr := strings.clone_to_cstring(old, context.temp_allocator)
|
||||||
|
|||||||
Reference in New Issue
Block a user