Constructor to initialize state common for VFSFile implementations.
Constructor to initialize a VFSFile without a parent.
File mode (used by implementations);
Close the file, finalizing any file operations.
Open the file for reading.
Open the file for writing/appending.
Read up to target.length bytes to target from current file position.
Seek offset bytes from origin within the file.
Write data.length bytes to file from current file position.
Get file size in bytes.
Does the file exist?
Open the file and get reading access.
Get name of the file.
Is the file open?
Open the file and get writing access. Must not already be open.
Get full path of the file in the VFS.
Is it possible to write to this file?
Proxies to for derived VFSFiles to call protected members of other VFSFiles.
Proxies to for derived VFSFiles to call protected members of other VFSFiles.
1 VFSDir dir = new FSDir("main", "./user_data/main", Yes.writable); 2 3 //Get the file from a directory. 4 VFSFile file = dir.file("logs/memory.log"); 5 6 //Print information about the file (note that we can only get file size of an existing file): 7 writeln("name: ", file.name, ", full path: ", file.path, 8 ", writable: ", file.writable, ", exists: ", file.exists, 9 ", size in bytes: ", file.bytes); 10 11 //Get access to read from the file: 12 auto input = file.input; 13 14 //Simply read the file to a buffer: 15 auto buffer = new ubyte[file.bytes]; 16 file.input.read(buffer); 17 18 //Get access to write to the file: 19 auto output = file.output; 20 21 //Simply write a buffer to the file: 22 file.output.write(cast(const void[])"The answer is 42");
A file in the VFS.
Provides basic file information and access to I/O.
File names in the VFS can contain any characters except /, which is used as directory separator, and the :: sequence, which is used for explicit package lookup (see StackDir).