|
Monad Engine da02fba2
> Undercity Codex_
|
Resolves asset paths and loads files into memory. More...
#include <FileSystem.h>
Public Member Functions | |
| std::filesystem::path | GetExecutableFolder () const |
| Return the directory containing the running executable. | |
| std::filesystem::path | GetAssetsFolder () const |
| Return the runtime assets directory. | |
| std::vector< char > | LoadFile (const std::filesystem::path &path) |
| Load an arbitrary file into a byte buffer. | |
| std::vector< char > | LoadAssetFile (const std::string &relativePath) |
| Load a file from the assets directory into a byte buffer. | |
| std::string | LoadAssetFileText (const std::string &relativePath) |
| Load a text file from the assets directory into a string. | |
Resolves asset paths and loads files into memory.
Owned by the Engine singleton. All relative paths passed to Load* methods are resolved against GetAssetsFolder().
Definition at line 27 of file FileSystem.h.
| std::filesystem::path mnd::FileSystem::GetAssetsFolder | ( | ) | const |
Return the runtime assets directory.
Resolved as ASSETS_DIR relative to the executable folder. CMake copies the source-tree assets/ folder here post-build.
Definition at line 41 of file FileSystem.cpp.
References GetExecutableFolder(), and kAssetsDirName.
Referenced by mnd::ModelImporter::Import(), mnd::Texture::Load(), LoadAssetFile(), and mnd::GameObject::LoadGLTF().
| std::filesystem::path mnd::FileSystem::GetExecutableFolder | ( | ) | const |
Return the directory containing the running executable.
Definition at line 22 of file FileSystem.cpp.
Referenced by GetAssetsFolder().
| std::vector< char > mnd::FileSystem::LoadAssetFile | ( | const std::string & | relativePath | ) |
Load a file from the assets directory into a byte buffer.
| relativePath | Path relative to GetAssetsFolder(). |
Definition at line 73 of file FileSystem.cpp.
References GetAssetsFolder(), and LoadFile().
Referenced by mnd::Audio::Load(), and LoadAssetFileText().
| std::string mnd::FileSystem::LoadAssetFileText | ( | const std::string & | relativePath | ) |
Load a text file from the assets directory into a string.
| relativePath | Path relative to GetAssetsFolder(). |
Definition at line 78 of file FileSystem.cpp.
References LoadAssetFile().
Referenced by mnd::PostProcess::Init(), mnd::ParticleSystem::Init(), mnd::Material::Load(), mnd::Scene::Load(), and mnd::GameObject::LoadGLTF().
| std::vector< char > mnd::FileSystem::LoadFile | ( | const std::filesystem::path & | path | ) |
Load an arbitrary file into a byte buffer.
| path | Absolute or relative path to the file. |
Definition at line 52 of file FileSystem.cpp.
References LOG_ERROR.
Referenced by LoadAssetFile().