Add four new file system checking functions: Stat.isFile and Stat.isDirectory for querying entry type from a Stat object, and File.exists and Directory.exists static methods that return booleans by attempting to stat the path and checking the appropriate type. Also bump MAX_METHODS_PER_CLASS from 12 to 14 to accommodate the new Stat foreign methods, and clean up unused Scheduler imports in existing stat tests.
1.1 KiB
^title Stat Class
A data structure describing the low-level details of a file system entry.
Static Methods
Stat.path(path)
"Stats" the file or directory at path.
Methods
blockCount
The number of system blocks allocated on disk for the file.
blockSize
The preferred block size in bytes for interacting with the file. It may vary from file to file.
device
The ID of the device containing the entry.
group
Numeric group ID of the file's owner.
inode
The inode number of the entry.
isDirectory
Whether the file system entity is a directory.
isFile
Whether the file system entity is a regular file, as opposed to a directory or other special entity.
linkCount
The number of hard links to the entry.
mode
A bit field describing the entry's type and protection flags.
size
The size of the entry in bytes.
specialDevice
The device ID for the entry, if it's a special file.
user
Numeric user ID of the file's owner.