|
| | VirtualFilesystem (CStringView programFilepath) |
| | Initialize the virtual filesystem.
|
| | ~VirtualFilesystem () override |
| | Destructor.
|
| | VirtualFilesystem (const VirtualFilesystem &)=delete |
| | Copying a filesystem is not allowed, since it manages global state.
|
| | VirtualFilesystem (VirtualFilesystem &&)=delete |
| | Moving a filesystem is not allowed, since it manages global state.
|
| VirtualFilesystem & | operator= (const VirtualFilesystem &)=delete |
| | Copying a filesystem is not allowed, since it manages global state.
|
| VirtualFilesystem & | operator= (VirtualFilesystem &&)=delete |
| | Moving a filesystem is not allowed, since it manages global state.
|
| String | createStandardOutputDirectory (const StandardOutputDirectoryOptions &standardOutputDirectoryOptions) |
| | Get a suitable output directory for configuration files and other save data on the host platform, which is usually located somwhere within the user's home directory in a sub-folder tailored to this specific application.
|
| CStringView | getOutputDirectory () const noexcept override |
| | Get the current output directory of the virtual filesystem.
|
| void | setOutputDirectory (CStringView path) |
| | Set the output directory of the virtual filesystem, where all output files will be written.
|
| void | mountInputArchive (CStringView path, MountPriority priority=MountPriority::HIGHER) |
| | Mount a directory or archive on the host filesystem to the root input directory of the virtual filesystem.
|
| void | unmountInputArchive (CStringView path) |
| | Unmount a previously mounted input directory or archive on the host filesystem from the virtual filesystem.
|
| void | mountInputArchivesInMountedDirectory (CStringView filepath, CStringView archiveFileExtension, MountPriority priority=MountPriority::HIGHER, FunctionView< void(CStringView path)> callback=[](CStringView) -> void {}) |
| | Mount all archives in a given directory on the host filesystem to the root input directory of the virtual filesystem.
|
| CStringView | findInputArchiveOfFile (CStringView filepath) const noexcept override |
| | Get the host filepath of the mounted input archive on the host filesystem that contains a given virtual file.
|
| void | createOutputDirectory (CStringView filepath) override |
| | Create a new host directory relative to the current output directory, while also creating any missing parent directories along the way as needed.
|
| void | createParentOutputDirectories (CStringView filepath) override |
| | Create any missing parent directories above a host directory relative to the current output directory.
|
| void | deleteOutputFile (CStringView filepath) override |
| | Delete a host file or directory relative to the current output directory.
|
| bool | inputFileExists (CStringView filepath) const override |
| | Check if a given virtual filepath has a corresponding host file mounted.
|
| File::Metadata | getFileMetadata (CStringView filepath) const override |
| | Get the metadata of a file that is mounted at a given virtual filepath.
|
| void | forEachInputFilenameInDirectory (CStringView filepath, FunctionView< bool(CStringView filename)> callback) const override |
| | Iterate the filenames of all readable virtual filepaths that are direct children of a given directory.
|
| InputFileHandle | openInputFile (CStringView filepath) const override |
| | Open an input file in the virtual filesystem for reading.
|
| InputFileHandle | tryOpenInputFile (CStringView filepath) const override |
| | Try to open an input file in the virtual filesystem for reading.
|
| OutputFileHandle | openEmptyOutputFile (CStringView filepath) override |
| | Create a file relative to the current output directory and open it for writing, overwriting any existing file at the same filepath.
|
| void | createEmptyOutputFile (CStringView filepath) override |
| | Create an empty file relative to the current output directory, overwriting any existing file at the same filepath.
|
| OutputFileHandle | openOutputFileForAppending (CStringView filepath) override |
| | Open a file relative to the current output directory for appended writing, or create an empty file and open it if one didn't already exist.
|
| constexpr | Filesystem () noexcept=default |
| | Default constructor.
|
| virtual | ~Filesystem ()=default |
| | Virtual destructor.
|
| constexpr | Filesystem (const Filesystem &)=default |
| | Copy constructor.
|
| constexpr | Filesystem (Filesystem &&) noexcept=default |
| | Move constructor.
|
| Filesystem & | operator= (const Filesystem &)=default |
| | Copy assignment.
|
| Filesystem & | operator= (Filesystem &&) noexcept=default |
| | Move assignment.
|
| void | forEachInputFilenameInDirectory (CStringView filepath, auto callback) const |
| | Iterate the filenames of all readable virtual filepaths that are direct children of a given directory.
|
| Allocation< byte > | readInputFile (CStringView filepath) const |
| | Open an input file in the virtual filesystem for reading and read its full contents into an array of bytes.
|
| Optional< Allocation< byte > > | tryReadInputFile (CStringView filepath) const |
| | Try to open an input file in the virtual filesystem for reading and read its full contents into an array of bytes.
|
| ArrayList< byte > | readInputFileArrayList (CStringView filepath) const |
| | Open an input file in the virtual filesystem for reading and read its full contents into an array list of bytes.
|
| Optional< ArrayList< byte > > | tryReadInputFileArrayList (CStringView filepath) const |
| | Try to open an input file in the virtual filesystem for reading and read its full contents into an array list of bytes.
|
| Buffer< byte > | readInputFileBuffer (CStringView filepath) const |
| | Open an input file in the virtual filesystem for reading and read its full contents into a buffer of bytes.
|
| Optional< Buffer< byte > > | tryReadInputFileBuffer (CStringView filepath) const |
| | Try to open an input file in the virtual filesystem for reading and read its full contents into a buffer of bytes.
|
| String | readInputFileString (CStringView filepath) const |
| | Open an input file in the virtual filesystem for reading and read its full contents into a string of bytes.
|
| Optional< String > | tryReadInputFileString (CStringView filepath) const |
| | Try to open an input file in the virtual filesystem for reading and read its full contents into a string of bytes.
|
| Allocation< char > | readInputFileCString (CStringView filepath) const |
| | Open an input file in the virtual filesystem for reading and read its full contents into an allocated null-terminated string of bytes.
|
| Allocation< char > | tryReadInputFileCString (CStringView filepath) const |
| | Try to open an input file in the virtual filesystem for reading and read its full contents into an allocated null-terminated string of bytes.
|
Persistent system for managing the virtual filesystem.
This system supports multiple host filesystem directories being mounted to the same virtual mount point for reading, such that virtual filepaths are mapped to the corresponding host file with the highest mount priority. When creating and writing files, all output is directed to an optional output directory.
By default, no input archives are mounted, and no output directory is set, meaning that no files can be opened or created. To be able to read and write files, the recommended initialization procedure for a typical application is as follows:
.organizationName = "MyOrg",
.applicationName = "MyApp",
}));
CStringView getOutputDirectory() const noexcept override
Get the current output directory of the virtual filesystem.
void mountInputArchivesInMountedDirectory(CStringView filepath, CStringView archiveFileExtension, MountPriority priority=MountPriority::HIGHER, FunctionView< void(CStringView path)> callback=[](CStringView) -> void {})
Mount all archives in a given directory on the host filesystem to the root input directory of the vir...
void mountInputArchive(CStringView path, MountPriority priority=MountPriority::HIGHER)
Mount a directory or archive on the host filesystem to the root input directory of the virtual filesy...
void setOutputDirectory(CStringView path)
Set the output directory of the virtual filesystem, where all output files will be written.
String createStandardOutputDirectory(const StandardOutputDirectoryOptions &standardOutputDirectoryOptions)
Get a suitable output directory for configuration files and other save data on the host platform,...
VirtualFilesystem(CStringView programFilepath)
Initialize the virtual filesystem.