Minor changes to os2

This commit is contained in:
gingerBill
2024-02-17 13:41:54 +00:00
parent c5c2a4d09d
commit fa1875a8f1
5 changed files with 55 additions and 3 deletions
+4
View File
@@ -46,6 +46,8 @@ full_path_from_name :: proc(name: string, allocator: runtime.Allocator) -> (path
if name == "" {
name = "."
}
_TEMP_ALLOCATOR_GUARD()
p := win32.utf8_to_utf16(name, _temp_allocator())
n := win32.GetFullPathNameW(raw_data(p), 0, nil, nil)
@@ -129,6 +131,7 @@ _cleanpath_from_handle :: proc(f: ^File, allocator: runtime.Allocator) -> (strin
if n == 0 {
return "", _get_platform_error()
}
_TEMP_ALLOCATOR_GUARD()
buf := make([]u16, max(n, 260)+1, _temp_allocator())
n = win32.GetFinalPathNameByHandleW(h, raw_data(buf), u32(len(buf)), 0)
return _cleanpath_from_buf(buf[:n], allocator)
@@ -144,6 +147,7 @@ _cleanpath_from_handle_u16 :: proc(f: ^File) -> ([]u16, Error) {
if n == 0 {
return nil, _get_platform_error()
}
_TEMP_ALLOCATOR_GUARD()
buf := make([]u16, max(n, 260)+1, _temp_allocator())
n = win32.GetFinalPathNameByHandleW(h, raw_data(buf), u32(len(buf)), 0)
return _cleanpath_strip_prefix(buf[:n]), nil