UVStat.hx 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package asys.uv;
  2. class UVStat {
  3. public final dev:Int;
  4. public final mode:Int;
  5. public final nlink:Int;
  6. public final uid:Int;
  7. public final gid:Int;
  8. public final rdev:Int;
  9. public final ino:Int;
  10. public final size:Int;
  11. public final blksize:Int;
  12. public final blocks:Int;
  13. public final flags:Int;
  14. public final gen:Int;
  15. public function new(st_dev:Int, st_mode:Int, st_nlink:Int, st_uid:Int, st_gid:Int, st_rdev:Int, st_ino:Int, st_size:Int, st_blksize:Int, st_blocks:Int,
  16. st_flags:Int, st_gen:Int) {
  17. dev = st_dev;
  18. mode = st_mode;
  19. nlink = st_nlink;
  20. uid = st_uid;
  21. gid = st_gid;
  22. rdev = st_rdev;
  23. ino = st_ino;
  24. size = st_size;
  25. blksize = st_blksize;
  26. blocks = st_blocks;
  27. flags = st_flags;
  28. gen = st_gen;
  29. }
  30. public function isBlockDevice():Bool return (mode & asys.uv.UVConstants.S_IFMT) == asys.uv.UVConstants.S_IFBLK;
  31. public function isCharacterDevice():Bool return (mode & asys.uv.UVConstants.S_IFMT) == asys.uv.UVConstants.S_IFCHR;
  32. public function isDirectory():Bool return (mode & asys.uv.UVConstants.S_IFMT) == asys.uv.UVConstants.S_IFDIR;
  33. public function isFIFO():Bool return (mode & asys.uv.UVConstants.S_IFMT) == asys.uv.UVConstants.S_IFIFO;
  34. public function isFile():Bool return (mode & asys.uv.UVConstants.S_IFMT) == asys.uv.UVConstants.S_IFREG;
  35. public function isSocket():Bool return (mode & asys.uv.UVConstants.S_IFMT) == asys.uv.UVConstants.S_IFSOCK;
  36. public function isSymbolicLink():Bool return (mode & asys.uv.UVConstants.S_IFMT) == asys.uv.UVConstants.S_IFLNK;
  37. function get_permissions():FilePermissions return @:privateAccess new FilePermissions(mode & asys.uv.UVConstants.S_PERM);
  38. public var permissions(get, never):FilePermissions;
  39. }