1 #ifndef DONUT_FILESYSTEM_HPP
2 #define DONUT_FILESYSTEM_HPP
547 std::string outputDirectory{};
Unique handle to a file in the virtual Filesystem.
Definition: File.hpp:25
Persistent system for managing the virtual filesystem.
Definition: Filesystem.hpp:185
File openFile(const char *filepath) const
Open a file in the virtual filesystem for reading.
const char * findArchiveOfFile(const char *filepath) const
Get the host filepath of the mounted archive on the host filesystem that contains a given virtual fil...
Filesystem(Filesystem &&)=delete
Moving a filesystem is not allowed, since it manages global state.
void unmountArchives(std::span< const std::string > paths)
Unmount multiple archives.
Filesystem & operator=(Filesystem &&)=delete
Moving a filesystem is not allowed, since it manages global state.
std::string getStandardOutputDirectory(const char *organizationName, const char *applicationName) const
Get a suitable output directory for configuration files and other save data on the host platform,...
File appendFile(const char *filepath)
Open a file in the output directory specified by the virtual filesystem for appended writing.
File::Metadata getFileMetadata(const char *filepath) const
Get the metadata of a file that is mounted at a given virtual filepath.
void mountArchive(const char *path, FilesystemMountPriority priority=FilesystemMountPriority::HIGHER)
Mount a directory or archive on the host filesystem to the root directory of the virtual filesystem.
bool fileExists(const char *filepath) const
Check if a given virtual filepath has a corresponding host file mounted.
Filesystem(const Filesystem &)=delete
Copying a filesystem is not allowed, since it manages global state.
Filesystem(const char *programFilepath, const FilesystemOptions &options={})
Initialize the virtual filesystem.
File createFile(const char *filepath)
Create a file in the output directory and open it for writing, overwriting any existing file at the s...
std::vector< std::string > getFilenamesInDirectory(const char *filepath) const
Get a list of the filenames of all readable virtual filepaths that are direct children of a given dir...
std::string getOutputDirectory() const
Get the current output directory of the virtual filesystem.
void createDirectory(const char *filepath)
Create a new host directory in the output directory.
void deleteFile(const char *filepath)
Delete a host file or directory in the output directory.
void unmountArchive(const char *path)
Unmount a previously mounted directory or archive on the host filesystem from the virtual filesystem.
Filesystem & operator=(const Filesystem &)=delete
Copying a filesystem is not allowed, since it manages global state.
void setOutputDirectory(std::string path)
Set the output directory of the virtual filesystem, where all output files will be written.
std::vector< std::string > mountArchives(const char *filepath, const char *archiveFileExtension, FilesystemMountPriority priority=FilesystemMountPriority::HIGHER)
Mount all archives in a given directory on the host filesystem to the root directory of the virtual f...
Definition: Application.hpp:9
FilesystemMountPriority
Mount priority for a newly mounted archive to a virtual Filesystem, relative to all previously mounte...
Definition: Filesystem.hpp:16
@ HIGHER
Mount the archive at a higher priority than any previously mounted archive, meaning files in the new ...
@ LOWER
Mount the archive at a lower priority than any previously mounted archive, meaning files in already m...
Configuration options for a virtual Filesystem.
Definition: Filesystem.hpp:35
FilesystemMountPriority mountPriorityOfArchiveSearchRelativeToDataDirectory
Mount priority of the additional initial archives relative to the main data directory.
Definition: Filesystem.hpp:159
FilesystemMountPriority mountPriorityOfArchiveSearchRelativeToOutputDirectory
Mount priority of the additional initial archives relative to the initial write directory.
Definition: Filesystem.hpp:147
FilesystemMountPriority mountPriorityOfDataDirectoryRelativeToOutputDirectory
Mount priority of the main data directory relative to the initial write directory.
Definition: Filesystem.hpp:135
const char * organizationName
Non-owning pointer to a null-terminated UTF-8 string that commonly identifies the publisher of the ap...
Definition: Filesystem.hpp:57
const char * dataDirectory
Non-owning pointer to a null-terminated UTF-8 string of the host filepath to the main data directory ...
Definition: Filesystem.hpp:94
const char * archiveSearchPath
Non-owning pointer to a null-terminated UTF-8 string of the virtual filepath to a directory in which ...
Definition: Filesystem.hpp:106
const char * archiveSearchFileExtension
Non-owning pointer to a null-terminated UTF-8 string of the filename extension of initial archives to...
Definition: Filesystem.hpp:121
const char * applicationName
Non-owning pointer to a null-terminated UTF-8 string that uniquely identifies the application among a...
Definition: Filesystem.hpp:80
bool mountOutputDirectory
Mount the initial output directory for reading in addition to writing.
Definition: Filesystem.hpp:172