stat.odin 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package os2
  2. import "core:time"
  3. import "base:runtime"
  4. File_Info :: struct {
  5. fullpath: string,
  6. name: string,
  7. size: i64,
  8. mode: File_Mode,
  9. is_directory: bool,
  10. creation_time: time.Time,
  11. modification_time: time.Time,
  12. access_time: time.Time,
  13. }
  14. file_info_slice_delete :: proc(infos: []File_Info, allocator: runtime.Allocator) {
  15. for i := len(infos)-1; i >= 0; i -= 1 {
  16. file_info_delete(infos[i], allocator)
  17. }
  18. delete(infos, allocator)
  19. }
  20. file_info_delete :: proc(fi: File_Info, allocator: runtime.Allocator) {
  21. delete(fi.fullpath, allocator)
  22. }
  23. fstat :: proc(f: ^File, allocator: runtime.Allocator) -> (File_Info, Error) {
  24. return _fstat(f, allocator)
  25. }
  26. stat :: proc(name: string, allocator: runtime.Allocator) -> (File_Info, Error) {
  27. return _stat(name, allocator)
  28. }
  29. lstat :: stat_do_not_follow_links
  30. stat_do_not_follow_links :: proc(name: string, allocator: runtime.Allocator) -> (File_Info, Error) {
  31. return _lstat(name, allocator)
  32. }
  33. same_file :: proc(fi1, fi2: File_Info) -> bool {
  34. return _same_file(fi1, fi2)
  35. }