yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::AssetLoader Class Reference

Cross-platform asset file loading utility. More...

#include <asset_loader.h>

Static Public Member Functions

static absl::StatusOr< std::string > LoadTextFile (const std::string &relative_path)
 
static absl::StatusOr< std::filesystem::path > FindAssetFile (const std::string &relative_path)
 
static std::vector< std::filesystem::path > GetSearchPaths (const std::string &relative_path)
 
static bool AssetExists (const std::string &relative_path)
 

Detailed Description

Cross-platform asset file loading utility.

Handles platform-specific paths for loading assets from:

  • macOS bundle resources
  • Windows relative paths
  • Linux relative paths
  • Development build directories

Definition at line 23 of file asset_loader.h.

Member Function Documentation

◆ LoadTextFile()

absl::StatusOr< std::string > yaze::AssetLoader::LoadTextFile ( const std::string &  relative_path)
static

Load a text file from the assets directory

Parameters
relative_pathPath relative to assets/ (e.g., "agent/system_prompt.txt")
Returns
File contents or error

Definition at line 64 of file asset_loader.cc.

References FindAssetFile().

Referenced by yaze::editor::AgentEditor::DrawCommonTilesEditor(), yaze::editor::AgentEditor::DrawNewPromptCreator(), and yaze::editor::AgentEditor::DrawPromptEditorPanel().

Here is the call graph for this function:

◆ FindAssetFile()

absl::StatusOr< std::filesystem::path > yaze::AssetLoader::FindAssetFile ( const std::string &  relative_path)
static

Find an asset file by trying multiple platform-specific paths

Parameters
relative_pathPath relative to assets/
Returns
Full path to file or error

Definition at line 44 of file asset_loader.cc.

References GetSearchPaths().

Referenced by AssetExists(), and LoadTextFile().

Here is the call graph for this function:

◆ GetSearchPaths()

std::vector< std::filesystem::path > yaze::AssetLoader::GetSearchPaths ( const std::string &  relative_path)
static

Get list of search paths for a given asset

Parameters
relative_pathPath relative to assets/
Returns
Vector of paths to try in order

Definition at line 12 of file asset_loader.cc.

References yaze::util::GetBundleResourcePath().

Referenced by FindAssetFile().

Here is the call graph for this function:

◆ AssetExists()

bool yaze::AssetLoader::AssetExists ( const std::string &  relative_path)
static

Check if an asset file exists

Parameters
relative_pathPath relative to assets/
Returns
true if file exists in any search path

Definition at line 89 of file asset_loader.cc.

References FindAssetFile().

Here is the call graph for this function:

The documentation for this class was generated from the following files: