feat: add Stat.isFile, Stat.isDirectory, File.exists, and Directory.exists methods

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.
This commit is contained in:
Bob Nystrom
2016-02-21 20:23:33 +00:00
parent 7f744565fc
commit 1973934fa2
15 changed files with 149 additions and 28 deletions
+26 -17
View File
@@ -10,45 +10,54 @@ A data structure describing the low-level details of a file system entry.
## 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.
[inode]: https://en.wikipedia.org/wiki/Inode
### **mode**
### **isDirectory**
A bit field describing the entry's type and protection flags.
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.
### **user**
### **mode**
Numeric user ID of the file's owner.
### **group**
Numeric group ID of the file's owner.
### **specialDevice**
The device ID for the entry, if it's a special file.
A bit field describing the entry's type and protection flags.
### **size**
The size of the entry in bytes.
### **blockSize**
### **specialDevice**
The preferred block size in bytes for interacting with the file. It may vary
from file to file.
The device ID for the entry, if it's a special file.
### **blockCount**
### **user**
The number of system blocks allocated on disk for the file.
Numeric user ID of the file's owner.