Radium Engine  1.5.20
Loading...
Searching...
No Matches
Ra::Core::Resources Namespace Reference

Resources paths, plugins paths and data paths management for Radium. More...

Functions

Resources path functions
optional< std::stringgetRadiumResourcesPath ()
 Get the path of Radium internal resources.
 
optional< std::stringgetRadiumPluginsPath ()
 Get the path of Radium embedded plugins.
 
optional< std::stringgetBasePath ()
 this one is always found, use optional for consistency ?
 
optional< std::stringgetResourcesPath (void *symbol=nullptr, const std::string &pattern="Resources")
 Search for general resource path.
 
Data path functions

These functions manage a stack of paths so that applications, libraries or plugins could manage paths to store their generated data in a state stack-based approach.

std::string getDataPath ()
 Get the current data path.
 
std::string popDataPath ()
 Pop the current data path.
 
void pushDataPath (std::string datapath)
 Push a new data path.
 

Detailed Description

Resources paths, plugins paths and data paths management for Radium.

This namespace contains functions, classes and utilities for resource management. Resources are :

  • configuration file (ui, keymapping, ...)
  • default shaders
  • ...

This namespace also contains functions allowing to set and access paths to store data generated by Radium applications, plugins or libraries in a portable way. If not set, the default data path is the working directory of the application. For Gui::BaseApplication derived applications, and for plugins, the default data path can be set using command line parameter and is stored in the application settings.

See also
Gui::BaseApplication::BaseApplication

Function Documentation

◆ getBasePath()

RA_CORE_API optional< std::string > Ra::Core::Resources::getBasePath ( )

this one is always found, use optional for consistency ?

Get the path of the current executable.

Returns
the path prefix to access the current executable (always found)

Definition at line 53 of file Resources.cpp.

◆ getDataPath()

RA_CORE_API std::string Ra::Core::Resources::getDataPath ( )

Get the current data path.

If an application's data path was not pushed before the call of this function, the default value, corresponding to the current working directory is returned. Otherwise, the last path pushed using a call to pushDataPath() is returned.

Definition at line 70 of file Resources.cpp.

◆ getRadiumPluginsPath()

RA_CORE_API optional< std::string > Ra::Core::Resources::getRadiumPluginsPath ( )

Get the path of Radium embedded plugins.

Radium embedded plugins are located in the Plugins directory, searched from Radium lib location.

Returns
the path to access Radium Plugins. empty string if not found
Note
the pattern searched is "Plugins/lib" since it's the basic resources dir.

Definition at line 44 of file Resources.cpp.

+ Here is the call graph for this function:

◆ getRadiumResourcesPath()

RA_CORE_API optional< std::string > Ra::Core::Resources::getRadiumResourcesPath ( )

Get the path of Radium internal resources.

Radium resources are located in the Resources directory, searched from Radium lib location.

Returns
the path to access Radium Resources if found, otherwise !has_value
Note
the pattern searched is "Resources/Radium" since it's the basic resources dir.

Definition at line 35 of file Resources.cpp.

+ Here is the call graph for this function:

◆ getResourcesPath()

RA_CORE_API optional< std::string > Ra::Core::Resources::getResourcesPath ( void * symbol = nullptr,
const std::string & pattern = "Resources" )

Search for general resource path.

Search for an accessible Resources (or pattern if given) directory in the current executable (or symbol if != nullptr) path or its parents.

Returns
the pattern path of the dynamic library or exec that contains the given symbol if found, otherwise !has_value

Definition at line 57 of file Resources.cpp.

◆ popDataPath()

RA_CORE_API std::string Ra::Core::Resources::popDataPath ( )

Pop the current data path.

The returned data path is removed from the data path stack and will not be available anymore for getDataPath().

Returns
the popped data path.

Definition at line 75 of file Resources.cpp.

◆ pushDataPath()

RA_CORE_API void Ra::Core::Resources::pushDataPath ( std::string datapath)

Push a new data path.

The pushed data path will be returned by getDataPath until it is popped.

Parameters
datapaththe data path to set as current

Definition at line 82 of file Resources.cpp.

+ Here is the call graph for this function: