mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Add Fstat_Callback for File.user_fstat
This commit is contained in:
@@ -5,8 +5,9 @@ import "core:time"
|
|||||||
import "base:runtime"
|
import "base:runtime"
|
||||||
|
|
||||||
File :: struct {
|
File :: struct {
|
||||||
impl: _File,
|
impl: _File,
|
||||||
stream: io.Stream,
|
stream: io.Stream,
|
||||||
|
user_fstat: Fstat_Callback,
|
||||||
}
|
}
|
||||||
|
|
||||||
File_Mode :: distinct u32
|
File_Mode :: distinct u32
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package os2
|
|||||||
import "core:time"
|
import "core:time"
|
||||||
import "base:runtime"
|
import "base:runtime"
|
||||||
|
|
||||||
|
Fstat_Callback :: proc(f: ^File, allocator: runtime.Allocator) -> (File_Info, Error)
|
||||||
|
|
||||||
File_Info :: struct {
|
File_Info :: struct {
|
||||||
fullpath: string,
|
fullpath: string,
|
||||||
name: string,
|
name: string,
|
||||||
@@ -27,6 +29,9 @@ file_info_delete :: proc(fi: File_Info, allocator: runtime.Allocator) {
|
|||||||
|
|
||||||
@(require_results)
|
@(require_results)
|
||||||
fstat :: proc(f: ^File, allocator: runtime.Allocator) -> (File_Info, Error) {
|
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)
|
return _fstat(f, allocator)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user