From 59c33dd9fce58f2fdf396a622c446f3912e88a95 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 14 May 2024 18:57:03 +0100 Subject: [PATCH] Add `Fstat_Callback` for `File.user_fstat` --- core/os/os2/file.odin | 3 ++- core/os/os2/stat.odin | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/os/os2/file.odin b/core/os/os2/file.odin index b6e9472fb..4f4bd942e 100644 --- a/core/os/os2/file.odin +++ b/core/os/os2/file.odin @@ -5,8 +5,9 @@ import "core:time" import "base:runtime" File :: struct { - impl: _File, + impl: _File, stream: io.Stream, + user_fstat: Fstat_Callback, } File_Mode :: distinct u32 diff --git a/core/os/os2/stat.odin b/core/os/os2/stat.odin index 16f319046..f79ad9165 100644 --- a/core/os/os2/stat.odin +++ b/core/os/os2/stat.odin @@ -3,6 +3,8 @@ package os2 import "core:time" import "base:runtime" +Fstat_Callback :: proc(f: ^File, allocator: runtime.Allocator) -> (File_Info, Error) + File_Info :: struct { fullpath: string, name: string, @@ -27,6 +29,9 @@ file_info_delete :: proc(fi: File_Info, allocator: runtime.Allocator) { @(require_results) fstat :: proc(f: ^File, allocator: runtime.Allocator) -> (File_Info, Error) { + if f != nil && f.user_fstat != nil { + return f->user_fstat(allocator) + } return _fstat(f, allocator) }