Orxonox  0.0.5 Codename: Arcturus
ApplicationPaths.h
Go to the documentation of this file.
1 /*
2  * ORXONOX - the hottest 3D action shooter ever to exist
3  * > www.orxonox.net <
4  *
5  *
6  * License notice:
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  * Author:
23  * Reto Grieder
24  * Co-authors:
25  * ...
26  *
27  */
28 
34 #ifndef _ApplicationPaths_H__
35 #define _ApplicationPaths_H__
36 
37 #include "CorePrereqs.h"
38 
39 #include <string>
40 #include <vector>
41 #include "util/Singleton.h"
42 
43 //tolua_begin
44 namespace orxonox
45 {
46 //tolua_end
57  class _CoreExport ApplicationPaths //tolua_export
58  : public Singleton<ApplicationPaths>
59  { //tolua_export
60  friend class Singleton<ApplicationPaths>;
61 
62  public:
74 
77  { return getInstance().rootPath_; }
80  { return getInstance().executablePath_; }
83  { return getInstance().modulePath_; }
86  { return getInstance().pluginPath_; }
87 
89  static std::string getRootPathString();
91  static std::string getExecutablePathString();
93  static std::string getModulePathString();
95  static std::string getPluginPathString();
96 
98  static bool buildDirectoryRun() { return getInstance().bBuildDirectoryRun_; }
99 
101  std::map<std::string, std::string> getModulePaths();
103  std::map<std::string, std::string> getPluginPaths();
104 
105  private:
106  // non-copyable:
107  ApplicationPaths(const ApplicationPaths&) = delete;
108  ApplicationPaths& operator=(const ApplicationPaths&) = delete;
109 
110  std::map<std::string, std::string> getModuleOrPluginPaths(boost::filesystem::path& directory, const std::string& extension);
111 
117 
120  }; //tolua_export
121 } //tolua_export
122 
123 #endif /* _ApplicationPaths_H__ */
The ApplicationPaths class is a singleton which provides static paths of the application.
Definition: ApplicationPaths.h:57
Shared library macros, enums, constants and forward declarations for the core library ...
::std::string string
Definition: gtest-port.h:756
static bool buildDirectoryRun()
Return true for runs in the build directory (not installed)
Definition: ApplicationPaths.h:98
Definition: CorePrereqs.h:316
boost::filesystem::path & executablePath_
Path to the executable.
Definition: ApplicationPaths.h:114
boost::filesystem::path & modulePath_
Path to the modules.
Definition: ApplicationPaths.h:115
Base for singleton classes.
Definition: Singleton.h:114
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
#define _CoreExport
Definition: CorePrereqs.h:61
static ApplicationPaths * singletonPtr_s
Static pointer to the singleton.
Definition: ApplicationPaths.h:119
static const boost::filesystem::path & getModulePath()
Returns the path to the modules as boost::filesystem::path.
Definition: ApplicationPaths.h:82
Definition of the Singleton template that is used as base class for classes that allow only one insta...
boost::filesystem::path & pluginPath_
Path to the plugins.
Definition: ApplicationPaths.h:116
bool bBuildDirectoryRun_
True for runs in the build directory (not installed)
Definition: ApplicationPaths.h:118
static const boost::filesystem::path & getExecutablePath()
Returns the path to the executable folder as boost::filesystem::path.
Definition: ApplicationPaths.h:79
static const boost::filesystem::path & getPluginPath()
Returns the path to the plugins as boost::filesystem::path.
Definition: ApplicationPaths.h:85
static const boost::filesystem::path & getRootPath()
Returns the path to the root folder as boost::filesystem::path.
Definition: ApplicationPaths.h:76
boost::filesystem::path & rootPath_
Path to the parent directory of the ones above if program was installed with relative paths...
Definition: ApplicationPaths.h:113