From 8a63b6dff768fae4e164fbaeac4597eca8a6cb8d Mon Sep 17 00:00:00 2001 From: Justin Hurstwright Date: Fri, 26 Jan 2024 18:08:33 -0600 Subject: [PATCH] fix: remove returns ErrNo for Windows, FreeBSD, Unix --- core/os/os_darwin.odin | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/os/os_darwin.odin b/core/os/os_darwin.odin index 0a729267c..f2418c7b5 100644 --- a/core/os/os_darwin.odin +++ b/core/os/os_darwin.odin @@ -527,6 +527,7 @@ get_last_error_string :: proc() -> string { return cast(string)_darwin_string_error(cast(c.int)get_last_error()) } + open :: proc(path: string, flags: int = O_RDWR, mode: int = 0) -> (Handle, Errno) { isDir := is_dir_path(path) flags := flags @@ -727,10 +728,14 @@ rename :: proc(old: string, new: string) -> bool { return _unix_rename(old_cstr, new_cstr) != -1 } -remove :: proc(path: string) -> bool { +remove :: proc(path: string) -> Errno { runtime.DEFAULT_TEMP_ALLOCATOR_TEMP_GUARD() path_cstr := strings.clone_to_cstring(path, context.temp_allocator) - return _unix_remove(path_cstr) != -1 + res := _unix_remove(path_cstr) + if res == -1 { + return Errno(get_last_error()) + } + return ERROR_NONE } @private