Ember
Loading...
Searching...
No Matches
EmberForge::ResourcePath Class Reference

Singleton utility for resolving resource paths. More...

#include <ResourcePath.h>

Static Public Member Functions

static wxString Get (const wxString &relativePath)
 Get the full path to a resource file.
static wxString GetDir (const wxString &relativeDir)
 Get the full path to a resource directory.
static wxString GetResourcesDir ()
 Get the base resources directory.
static bool Exists (const wxString &relativePath)
 Check if a resource exists.
static void Refresh ()
 Force re-detection of resources directory.

Private Member Functions

 ResourcePath ()=default

Static Private Member Functions

static wxString FindResourcesDir ()
static wxString & GetCachedDir ()

Static Private Attributes

static bool s_initialized = false

Detailed Description

Singleton utility for resolving resource paths.

Usage: wxString iconPath = ResourcePath::Get("icons/tree_nodes/action.png"); wxString configDir = ResourcePath::GetDir("config");

Definition at line 27 of file ResourcePath.h.

Constructor & Destructor Documentation

◆ ResourcePath()

EmberForge::ResourcePath::ResourcePath ( )
privatedefault

Member Function Documentation

◆ Exists()

bool EmberForge::ResourcePath::Exists ( const wxString & relativePath)
static

Check if a resource exists.

Parameters
relativePathPath relative to the resources directory
Returns
true if the resource file/directory exists

Definition at line 59 of file ResourcePath.cpp.

◆ FindResourcesDir()

wxString EmberForge::ResourcePath::FindResourcesDir ( )
staticprivate

Definition at line 74 of file ResourcePath.cpp.

◆ Get()

wxString EmberForge::ResourcePath::Get ( const wxString & relativePath)
static

Get the full path to a resource file.

Parameters
relativePathPath relative to the resources directory
Returns
Full absolute path to the resource

Definition at line 17 of file ResourcePath.cpp.

◆ GetCachedDir()

wxString & EmberForge::ResourcePath::GetCachedDir ( )
staticprivate

Definition at line 69 of file ResourcePath.cpp.

◆ GetDir()

wxString EmberForge::ResourcePath::GetDir ( const wxString & relativeDir)
static

Get the full path to a resource directory.

Parameters
relativeDirDirectory path relative to resources
Returns
Full absolute path to the directory (with trailing separator)

Definition at line 33 of file ResourcePath.cpp.

◆ GetResourcesDir()

wxString EmberForge::ResourcePath::GetResourcesDir ( )
static

Get the base resources directory.

Returns
Full path to the resources directory

Definition at line 44 of file ResourcePath.cpp.

◆ Refresh()

void EmberForge::ResourcePath::Refresh ( )
static

Force re-detection of resources directory.

Useful if environment changes at runtime (rare)

Definition at line 64 of file ResourcePath.cpp.

Member Data Documentation

◆ s_initialized

bool EmberForge::ResourcePath::s_initialized = false
staticprivate

Definition at line 68 of file ResourcePath.h.


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