Skip to content

Commit 93fa00c

Browse files
committed
Use _get_platform_error() where more appropriate
1 parent 360d93b commit 93fa00c

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

core/os/os2/path_posix.odin

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ _get_absolute_path :: proc(path: string, allocator: runtime.Allocator) -> (absol
133133
rel_cstr := clone_to_cstring(rel, temp_allocator) or_return
134134
path_ptr := posix.realpath(rel_cstr, nil)
135135
if path_ptr == nil {
136-
return "", Platform_Error(posix.errno())
136+
return "", _get_platform_error()
137137
}
138138
defer posix.free(path_ptr)
139139

core/os/os2/path_windows.odin

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,13 @@ _get_absolute_path :: proc(path: string, allocator: runtime.Allocator) -> (absol
305305
rel_utf16 := win32.utf8_to_utf16(rel, temp_allocator)
306306
n := win32.GetFullPathNameW(cstring16(raw_data(rel_utf16)), 0, nil, nil)
307307
if n == 0 {
308-
return "", Platform_Error(win32.GetLastError())
308+
return "", _get_platform_error()
309309
}
310310

311311
buf := make([]u16, n, temp_allocator) or_return
312312
n = win32.GetFullPathNameW(cstring16(raw_data(rel_utf16)), u32(n), cstring16(raw_data(buf)), nil)
313313
if n == 0 {
314-
return "", Platform_Error(win32.GetLastError())
314+
return "", _get_platform_error()
315315
}
316316

317317
return win32.utf16_to_utf8(buf, allocator)

core/os/os2/stat_windows.odin

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,9 @@ _file_info_from_get_file_information_by_handle :: proc(path: string, h: win32.HA
287287

288288
ti: win32.FILE_ATTRIBUTE_TAG_INFO
289289
if !win32.GetFileInformationByHandleEx(h, .FileAttributeTagInfo, &ti, size_of(ti)) {
290-
err := win32.GetLastError()
291-
if err != win32.ERROR_INVALID_PARAMETER {
292-
return {}, Platform_Error(err)
290+
err := _get_platform_error()
291+
if perr, ok := is_platform_error(err); ok && perr != i32(win32.ERROR_INVALID_PARAMETER) {
292+
return {}, err
293293
}
294294
// Indicate this is a symlink on FAT file systems
295295
ti.ReparseTag = 0

0 commit comments

Comments
 (0)