From 93fa00c19187f934cda7988a19409dd0181e2505 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Fri, 14 Nov 2025 21:08:32 +0000 Subject: [PATCH] Use `_get_platform_error()` where more appropriate --- core/os/os2/path_posix.odin | 2 +- core/os/os2/path_windows.odin | 4 ++-- core/os/os2/stat_windows.odin | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/os/os2/path_posix.odin b/core/os/os2/path_posix.odin index f22cd446b..173cb6b6d 100644 --- a/core/os/os2/path_posix.odin +++ b/core/os/os2/path_posix.odin @@ -133,7 +133,7 @@ _get_absolute_path :: proc(path: string, allocator: runtime.Allocator) -> (absol rel_cstr := clone_to_cstring(rel, temp_allocator) or_return path_ptr := posix.realpath(rel_cstr, nil) if path_ptr == nil { - return "", Platform_Error(posix.errno()) + return "", _get_platform_error() } defer posix.free(path_ptr) diff --git a/core/os/os2/path_windows.odin b/core/os/os2/path_windows.odin index e5a1545ec..1225ab2ce 100644 --- a/core/os/os2/path_windows.odin +++ b/core/os/os2/path_windows.odin @@ -305,13 +305,13 @@ _get_absolute_path :: proc(path: string, allocator: runtime.Allocator) -> (absol rel_utf16 := win32.utf8_to_utf16(rel, temp_allocator) n := win32.GetFullPathNameW(cstring16(raw_data(rel_utf16)), 0, nil, nil) if n == 0 { - return "", Platform_Error(win32.GetLastError()) + return "", _get_platform_error() } buf := make([]u16, n, temp_allocator) or_return n = win32.GetFullPathNameW(cstring16(raw_data(rel_utf16)), u32(n), cstring16(raw_data(buf)), nil) if n == 0 { - return "", Platform_Error(win32.GetLastError()) + return "", _get_platform_error() } return win32.utf16_to_utf8(buf, allocator) diff --git a/core/os/os2/stat_windows.odin b/core/os/os2/stat_windows.odin index 20a708145..651029ac3 100644 --- a/core/os/os2/stat_windows.odin +++ b/core/os/os2/stat_windows.odin @@ -287,9 +287,9 @@ _file_info_from_get_file_information_by_handle :: proc(path: string, h: win32.HA ti: win32.FILE_ATTRIBUTE_TAG_INFO if !win32.GetFileInformationByHandleEx(h, .FileAttributeTagInfo, &ti, size_of(ti)) { - err := win32.GetLastError() - if err != win32.ERROR_INVALID_PARAMETER { - return {}, Platform_Error(err) + err := _get_platform_error() + if perr, ok := is_platform_error(err); ok && perr != i32(win32.ERROR_INVALID_PARAMETER) { + return {}, err } // Indicate this is a symlink on FAT file systems ti.ReparseTag = 0