1
//---------------------------------------------------------------------------
3
// Project: OpenWalnut ( http://www.openwalnut.org )
5
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6
// For more information see http://www.openwalnut.org/copying
8
// This file is part of OpenWalnut.
10
// OpenWalnut is free software: you can redistribute it and/or modify
11
// it under the terms of the GNU Lesser General Public License as published by
12
// the Free Software Foundation, either version 3 of the License, or
13
// (at your option) any later version.
15
// OpenWalnut is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
// GNU Lesser General Public License for more details.
20
// You should have received a copy of the GNU Lesser General Public License
21
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
23
//---------------------------------------------------------------------------
30
// Use filesystem version 2 for compatibility with newer boost versions.
31
#ifndef BOOST_FILESYSTEM_VERSION
32
#define BOOST_FILESYSTEM_VERSION 2
34
#include <boost/filesystem.hpp>
35
#include <boost/shared_ptr.hpp>
37
#include "WExportCommon.h"
40
* Singleton class helping to find files and paths. It is a useful to to search for resources and the central place to "hardcode" relative paths.
41
* It contains global paths only. Modules have their OWN local paths.
43
class OWCOMMON_EXPORT WPathHelper // NOLINT
50
virtual ~WPathHelper();
53
* Returns instance of the path helper. If it does not exists, it will be created.
55
* \return the running path helper instance.
57
static boost::shared_ptr< WPathHelper > getPathHelper();
60
* Set the current application path. This should be called only once.
62
* \param appPath the application path
64
void setAppPath( boost::filesystem::path appPath );
67
* The path where the binary file resides in. This is for example /usr/bin.
69
* \return the application path.
71
static boost::filesystem::path getAppPath();
74
* The path where font files reside in.
76
* \return the font path.
78
static boost::filesystem::path getFontPath();
81
* Paths to all known fonts.
86
* The default font to use in most cases.
88
boost::filesystem::path Default;
91
* The Regular font (not bold, not italic)
93
boost::filesystem::path Regular;
98
boost::filesystem::path Italic;
103
boost::filesystem::path Bold;
108
* The paths to all fonts supported.
110
* \return the file paths to all fonts
112
static Fonts getAllFonts();
115
* The path to the global shaders. Modules usually have their own local shader directory.
117
* \return global shader path.
119
static boost::filesystem::path getShaderPath();
122
* The path to the globally installed modules. This does not respect any environment variables or config options! Use this only to search
123
* global modules. To get a list of all module search paths, including user defined ones, use getAllModulePaths().
125
* \return path to globally installed modules.
127
static boost::filesystem::path getModulePath();
130
* This returns a list of search paths for modules. This list is defined by the environment variable "OW_MODULE_PATH". All of these
131
* directories CAN contain modules. On startup, they get searched in the specified order.
133
* \return list of search paths for modules
135
static std::vector< boost::filesystem::path > getAllModulePaths();
138
* The path to the OW libs. You normally should not need this.
140
* \return the path to the libs.
142
static boost::filesystem::path getLibPath();
145
* The path where shared files reside in.
147
* \return the shared files path.
149
static boost::filesystem::path getSharePath();
152
* The path where the doc files reside in.
154
* \return the doc file path.
156
static boost::filesystem::path getDocPath();
159
* The path where the config files reside in.
161
* \return the config file path.
163
static boost::filesystem::path getConfigPath();
168
* Constructors are protected because this is a Singleton.
175
* Application path. NOT the path of the binary. The application path is the directory in which the binary is placed.
176
* The binary path is m_appPath+"/openwalnut".
178
boost::filesystem::path m_appPath;
181
* The path where all the shared files reside in.
183
boost::filesystem::path m_sharePath;
186
* The path where all the documentation files reside in.
188
boost::filesystem::path m_docPath;
191
* The path where all the config files reside in.
193
boost::filesystem::path m_configPath;
196
* The path to the globally installed modules.
198
boost::filesystem::path m_modulePath;
201
* The path to the OW libs.
203
boost::filesystem::path m_libPath;
206
* Singleton instance of WPathHelper.
208
static boost::shared_ptr< WPathHelper > m_instance;
211
#endif // WPATHHELPER_H