stat.odin 1.0 KB

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