1#include <Core/Resources/Resources.hpp>
3#include <Core/Utils/Log.hpp>
4#include <Core/Utils/StdFilesystem.hpp>
7#include <cpplocate/cpplocate.h>
15using namespace Ra::Core::Utils;
16namespace fs = ::std::filesystem;
22 std::string p = cpplocate::locatePath( pattern, system, libSymbol );
23 return fs::path( p ).lexically_normal();
27fs::path clean(
const fs::path& path ) {
28 auto status = fs::status( path );
29 if ( status.type() == fs::file_type::not_found )
return "";
30 if ( status.type() == fs::file_type::directory )
return fs::canonical( path ) /
"";
31 return fs::canonical( path );
38 p = clean( p /
"Resources/Radium" );
40 if ( p.empty() )
return {};
46 p = clean( p /
"Plugins" /
"lib" );
48 if ( p.empty() )
return {};
54 return clean( cpplocate::getModulePath() ).string();
58 auto p = searchPath( pattern,
"", symbol );
59 p = clean( p / pattern );
60 if ( p.empty() )
return {};
71 if ( DataPath::s_dataPaths.empty() ) {
return fs::current_path().string(); }
72 return DataPath::s_dataPaths.top();
76 if ( DataPath::s_dataPaths.empty() ) {
return fs::current_path().string(); }
77 auto p = DataPath::s_dataPaths.top();
78 DataPath::s_dataPaths.pop();
83 DataPath::s_dataPaths.emplace(
std::move( datapath ) );
84 fs::create_directories( DataPath::s_dataPaths.top() );
std::string getDataPath()
Get the current data path.
std::string popDataPath()
Pop the current data path.
optional< std::string > getRadiumPluginsPath()
Get the path of Radium embedded plugins.
optional< std::string > getBasePath()
this one is always found, use optional for consistency ?
void pushDataPath(std::string datapath)
Push a new data path.
optional< std::string > getResourcesPath(void *symbol, const std::string &pattern)
Search for general resource path.
optional< std::string > getRadiumResourcesPath()
Get the path of Radium internal resources.
hepler function to manage enum as underlying types in VariableSet