mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-03 03:32:37 +00:00
Allow os.read_dir to use a different allocator
This commit is contained in:
@@ -4,7 +4,7 @@ import win32 "core:sys/windows"
|
||||
import "core:strings"
|
||||
import "core:time"
|
||||
|
||||
read_dir :: proc(fd: Handle, n: int) -> (fi: []File_Info, err: Errno) {
|
||||
read_dir :: proc(fd: Handle, n: int, allocator := context.allocator) -> (fi: []File_Info, err: Errno) {
|
||||
find_data_to_file_info :: proc(base_path: string, d: ^win32.WIN32_FIND_DATAW) -> (fi: File_Info) {
|
||||
// Ignore "." and ".."
|
||||
if d.cFileName[0] == '.' && d.cFileName[1] == 0 {
|
||||
@@ -53,6 +53,8 @@ read_dir :: proc(fd: Handle, n: int) -> (fi: []File_Info, err: Errno) {
|
||||
return nil, ERROR_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
context.allocator = allocator;
|
||||
|
||||
h := win32.HANDLE(fd);
|
||||
|
||||
dir_fi, _ := stat_from_file_information("", h);
|
||||
|
||||
Reference in New Issue
Block a user