![]() |
Lysa
0.0
Lysa 3D Engine
|
Virtual file system helper used to resolve portable paths.
Public Member Functions | |
| VirtualFS (const VirtualFSConfiguration &config, const std::shared_ptr< vireo::Vireo > &vireo) | |
| bool | fileExists (const std::string &filepath) const |
| bool | directoryExists (const std::string &dirPath) const |
| std::ifstream | openReadStream (const std::string &filepath) const |
| std::ofstream | openWriteStream (const std::string &filepath) const |
| std::string | parentPath (const std::string &filepath) const |
| void | loadBinaryData (const std::string &filepath, std::vector< char > &out) const |
| void | loadBinaryData (std::ifstream &input, std::vector< char > &out) const |
| std::byte * | loadImage (const std::string &filepath, uint32 &width, uint32 &height, uint64 &size) const |
| void | loadScript (const std::string &scriptName, std::vector< char > &out) const |
| void | loadShader (const std::string &shaderName, std::vector< char > &out) const |
| void | destroyImage (std::byte *image) const |
| std::string | getPath (const std::string &filepath) const |
| constexpr const std::string & | getScriptsDirectory () const |
| constexpr std::string | getScriptsURI () const |
Static Public Attributes | |
| static constexpr auto | APP_URI {"app://"} |
|
inline |
| void destroyImage | ( | std::byte * | image | ) | const |
Frees an image buffer allocated by loadImage().
| image | Pointer previously returned by loadImage() |
| bool directoryExists | ( | const std::string & | dirPath | ) | const |
Tests whether a directory exists at the given path or URI.
| dirPath | URI. |
| bool fileExists | ( | const std::string & | filepath | ) | const |
Tests whether a directory exists at the given path or URI.
| filepath | URI. |
Tests whether a regular file exists at the given path or URI.
| filepath | URI. |
| std::string getPath | ( | const std::string & | filepath | ) | const |
Resolves a path or app:// URI to a concrete OS path.
Implementations may expand environment variables, normalize separators, and map app:// to the application data/assets directory.
|
inlineconstexpr |
|
inlineconstexpr |
| void loadBinaryData | ( | const std::string & | filepath, |
| std::vector< char > & | out | ||
| ) | const |
Loads the entire file contents into a byte buffer.
| filepath | URI. |
| out | Destination buffer; its contents are replaced by the file bytes. |
| void loadBinaryData | ( | std::ifstream & | input, |
| std::vector< char > & | out | ||
| ) | const |
Loads the entire file contents into a byte buffer.
| input | Input stream. |
| out | Destination buffer; its contents are replaced by the file bytes. |
| std::byte* loadImage | ( | const std::string & | filepath, |
| uint32 & | width, | ||
| uint32 & | height, | ||
| uint64 & | size | ||
| ) | const |
Loads an image and returns an allocated RGBA (8‑bit per channel) buffer.
The caller owns the returned memory and must release it with destroyImage().
| filepath | URI. |
| width | Output image width in pixels. |
| height | Output image height in pixels. |
| size | Output total buffer size in bytes (width*height*4). |
| void loadScript | ( | const std::string & | scriptName, |
| std::vector< char > & | out | ||
| ) | const |
| void loadShader | ( | const std::string & | shaderName, |
| std::vector< char > & | out | ||
| ) | const |
| std::ifstream openReadStream | ( | const std::string & | filepath | ) | const |
Opens an input stream for reading the file at path or URI.
The returned stream is opened in binary mode unless the implementation states otherwise. Callers should check stream.is_open() (or its state) to ensure the file was successfully opened.
| filepath | URI. |
| std::ofstream openWriteStream | ( | const std::string & | filepath | ) | const |
Opens an output stream for writing the file at path or URI.
The returned stream is typically opened in binary mode and may create intermediate directories depending on platform support. Callers should check stream.is_open() (or its state) to ensure the file was successfully opened.
| filepath | URI. |
| std::string parentPath | ( | const std::string & | filepath | ) | const |
Returns the parent directory of the provided path or URI.
For app:// URIs, the parent is computed after resolution. Trailing separators are ignored.
| filepath | URI. |
|
staticconstexpr |
URI scheme used to reference files relative to the application root.