Fixed error handling in read_dir on Windows

This commit is contained in:
John Leidegren
2024-06-08 15:58:34 +02:00
committed by GitHub
parent 371749d474
commit 35e57fdef8

View File

@@ -87,8 +87,12 @@ read_dir :: proc(fd: Handle, n: int, allocator := context.allocator) -> (fi: []F
find_data := &win32.WIN32_FIND_DATAW{}
find_handle := win32.FindFirstFileW(raw_data(wpath_search), find_data)
if find_handle == win32.INVALID_HANDLE_VALUE {
e = Errno(win32.GetLastError())
return
}
defer win32.FindClose(find_handle)
for n != 0 && find_handle != nil {
for n != 0 {
fi: File_Info
fi = find_data_to_file_info(path, find_data)
if fi.name != "" {