31 #include <boost/tokenizer.hpp>
33 #include "WPathHelper.h"
35 #ifndef W_LIB_DIR_RELATIVE
36 #define W_LIB_DIR_RELATIVE "lib"
152 boost::filesystem::path resRel =
getPathHelper()->m_moduleResourcePathRelative / packageName;
158 if( boost::filesystem::exists( moduleLibPath / resRel ) )
160 return moduleLibPath / resRel;
162 else if( boost::filesystem::exists( moduleLibPath /
".." / resRel ) )
164 return moduleLibPath /
".." / resRel;
169 return moduleLibPath / resRel;
176 std::vector< boost::filesystem::path > paths;
182 std::string additionalPaths( getenv(
"OW_MODULE_PATH" ) ? getenv(
"OW_MODULE_PATH" ) :
"" );
185 typedef boost::tokenizer< boost::char_separator< char > > tokenizer;
186 boost::char_separator< char > sep(
";" );
187 tokenizer tok( additionalPaths, sep );
188 for( tokenizer::iterator it = tok.begin(); it != tok.end(); ++it )
190 paths.push_back( boost::filesystem::path( *it ) );
198 if( !std::count( paths.begin(), paths.end(), *it ) )
200 paths.push_back( *it );
static boost::filesystem::path getFontPath()
The path where font files reside in.
static std::shared_ptr< WPathHelper > m_instance
Singleton instance of WPathHelper.
const std::vector< boost::filesystem::path > & getAdditionalModulePaths() const
Returns the list of paths added using addAdditionalModulePath.
static boost::filesystem::path getSharePath()
The path where shared files reside in.
virtual ~WPathHelper()
Destructor.
boost::filesystem::path m_modulePath
The path to the globally installed modules.
static boost::filesystem::path getConfigPath()
The path where the config files reside in.
WPathHelper()
Constructors are protected because this is a Singleton.
boost::filesystem::path m_appPath
Application path.
static boost::filesystem::path getShaderPath()
The path to the global shaders.
static boost::filesystem::path getModulePath()
The path to the globally installed modules.
std::vector< boost::filesystem::path > m_additionalModulePaths
A list of additional paths to search for modules.
void setBasePaths(boost::filesystem::path appPath, boost::filesystem::path homePath)
Set the current application path.
boost::filesystem::path m_moduleResourcePathRelative
The path to module resources, relative to the module libraries path.
static boost::filesystem::path getLibPath()
The path to the OW libs.
boost::filesystem::path m_libPath
The path to the OW libs.
static Fonts getAllFonts()
The paths to all fonts supported.
static boost::filesystem::path getHomePath()
The path to the OW dir in the user's home.
static std::shared_ptr< WPathHelper > getPathHelper()
Returns instance of the path helper.
static boost::filesystem::path getModuleResourcePath(boost::filesystem::path moduleLibPath, std::string packageName)
The path to a given module's resources.
boost::filesystem::path m_configPath
The path where all the config files reside in.
void addAdditionalModulePath(const boost::filesystem::path &path)
This method adds the given path to the list of module paths.
void setBasePathsOSXBundle(boost::filesystem::path appPath, boost::filesystem::path homePath)
Set the current application path.
static std::vector< boost::filesystem::path > getAllModulePaths()
This returns a list of search paths for modules.
boost::filesystem::path m_docPath
The path where all the documentation files reside in.
boost::filesystem::path m_homePath
The path of a user specific OW directory.
static boost::filesystem::path getDocPath()
The path where the doc files reside in.
boost::filesystem::path m_sharePath
The path where all the shared files reside in.
static boost::filesystem::path getAppPath()
The path where the binary file resides in.
Paths to all known fonts.
boost::filesystem::path Regular
The Regular font (not bold, not italic)
boost::filesystem::path Bold
Bold font.
boost::filesystem::path Default
The default font to use in most cases.
boost::filesystem::path Italic
Italic font.