|
Flint Engine
Modular C++20 2D game engine powered by SDL3
|
Disk-backed implementation of IAssetLoader. More...
#include <flint/resource/filesystem.h>
Inheritance diagram for Flint::FileSystem:
Collaboration diagram for Flint::FileSystem:Public Member Functions | |
| FileSystem (std::filesystem::path root) | |
Construct a FileSystem rooted at root. | |
| FLINT_API std::vector< char > | getAsset (const std::string &path) override |
Read the entire file at path and return its bytes. | |
| FLINT_API uint64_t | getAssetRevision (const std::string &path) const override |
| Return the file's last-write-time tick count as a revision. | |
| FLINT_API bool | hasAsset (const std::string &path) const override |
Check whether a regular file exists at path. | |
| bool | isDoneLoading () const override |
Always true; FileSystem is synchronous with no background loading phase. | |
Public Member Functions inherited from Flint::IAssetLoader | |
Disk-backed implementation of IAssetLoader.
Loads assets from a directory tree rooted at the path given to the constructor. All asset paths are relative to that root; paths with a root name or root directory are rejected, as are paths whose canonical form resolves outside the root (including via symlinks).
Revision tracking uses file modification time, so changes are detected without re-reading contents. See getAssetRevision().
No internal synchronisation; concurrent calls require external locking.
Definition at line 32 of file filesystem.h.
|
inlineexplicit |
Construct a FileSystem rooted at root.
| root | Directory that acts as the asset root. May be absolute or relative to the process working directory. |
Definition at line 40 of file filesystem.h.
|
overridevirtual |
Read the entire file at path and return its bytes.
Opened in binary mode.
| path | Asset path relative to the root directory. |
| std::runtime_error | if the file cannot be opened, its size cannot be determined, the read fails, or path is invalid. |
Implements Flint::IAssetLoader.
|
overridevirtual |
Return the file's last-write-time tick count as a revision.
Compare for equality only; the value is not ordered — restoring a backup can move it backward.
| path | Asset path relative to the root directory. |
last_write_time, or 0 if the path is invalid, absent, not a regular file, or a filesystem error occurs. Implements Flint::IAssetLoader.
|
overridevirtual |
Check whether a regular file exists at path.
| path | Asset path relative to the root directory. |
true if the path resolves to an existing regular file. Implements Flint::IAssetLoader.
|
inlineoverridevirtual |
Always true; FileSystem is synchronous with no background loading phase.
true. Implements Flint::IAssetLoader.
Definition at line 81 of file filesystem.h.