|
| FileSystem (const char *argv0=nullptr) |
| Creates a file system.
|
|
bool | mount (const std::filesystem::path &real_path, const std::filesystem::path &mount_path, const bool &append=true) |
| Add an archive or a folder into the virtual file hierarchy.
|
|
bool | unmount (const std::string &real_path) |
| Remove a previously mounted folder/archive.
|
|
bool | mkdir (const std::string &path) |
| Create a new folder.
|
|
bool | isDir (const std::string &path) const noexcept |
| Check if the path points a dir in the virtual file system.
|
|
bool | remove (const std::string &path) |
| Remove a file.
|
|
size_t | getFileSize (const std::string &filename) const noexcept |
| Get a file size in bytes.
|
|
size_t | getLastAccessTime (const std::string &filename) const noexcept |
| Get a file last access time in UNIX timestamp.
|
|
size_t | getLastModificationTime (const std::string &filename) const noexcept |
| Get a file last modification time in UNIX timestamp.
|
|
bool | fileExists (const std::string &filename) const noexcept |
| Check if a file exists.
|
|
std::vector< uint8_t > | readFile (const std::string &filename) |
| Read binary file into a ByteArray.
|
|
std::string | readTextFile (const std::string &filename) |
| Read textual file into a string.
|
|
std::filesystem::path | getRealPath (const std::filesystem::path &path) const noexcept |
| Get actual folder on the disk where is stored the file/folder in virtual path.
|
|
std::filesystem::space_info | getDiskSpace (const std::filesystem::path &path) const noexcept |
| Get space information about the disk on which the virtual path is located.
|
|
bool | setWritePath (const std::string &real_path) |
| Bind a path on the actual disk where write is allowed if real_path not exists, it is recursively created (like mkdir -p )
|
|
std::string | getWritePath () const |
| Get the path used for writing.
|
|
std::vector< std::string > | scandir (const std::filesystem::path &directory) const |
| Return list of filenames contained in the directory.
|
|
std::string | getFilename (const std::string &partial_path, const std::vector< std::string > &allowed_suffixes) |
| Get file location from partial filename without extension and a list of allowed suffixes Example to find file providing extensions:
|
|
std::string | getBaseDir () |
|
std::string | generatePrefDir (const std::string &organization, const std::string &application) |
| Get (and create if not already exists) the 'pref dir' where users can write personal files (preferences / games saves, etc) that are specific to your application. This directory is unique per user, per application.
|
|
FileSystemError | getLastErrorCode () const noexcept |
| Get last error code.
|
|
std::string | getLastError () const noexcept |
| Get last error description.
|
|
Virtual file system wrapper.
- Note
- Due to PHYFS underlying mecanism, the write folder is not mounted by default for reading. All write function should get the path relative to the write folder