stat.odin 992 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package os2
  2. import "core:time"
  3. import "core:runtime"
  4. File_Info :: struct {
  5. fullpath: string,
  6. name: string,
  7. size: i64,
  8. mode: File_Mode,
  9. is_dir: 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 :: proc(name: string, allocator: runtime.Allocator) -> (File_Info, Error) {
  30. return _lstat(name, allocator)
  31. }
  32. same_file :: proc(fi1, fi2: File_Info) -> bool {
  33. return _same_file(fi1, fi2)
  34. }