Begin cleaning up os2.read_directory

This commit is contained in:
gingerBill
2024-07-24 14:19:30 +01:00
parent 38e983cac6
commit d4af7b86a7
4 changed files with 186 additions and 83 deletions
+11 -1
View File
@@ -1,7 +1,9 @@
package os2
import "core:time"
import "base:runtime"
import "core:path/filepath"
import "core:strings"
import "core:time"
Fstat_Callback :: proc(f: ^File, allocator: runtime.Allocator) -> (File_Info, Error)
@@ -19,6 +21,14 @@ File_Info :: struct {
access_time: time.Time,
}
@(require_results)
file_info_clone :: proc(fi: File_Info, allocator: runtime.Allocator) -> (cloned: File_Info, err: runtime.Allocator_Error) {
cloned = fi
cloned.fullpath = strings.clone(fi.fullpath) or_return
cloned.name = filepath.base(cloned.fullpath)
return
}
file_info_slice_delete :: proc(infos: []File_Info, allocator: runtime.Allocator) {
for i := len(infos)-1; i >= 0; i -= 1 {
file_info_delete(infos[i], allocator)