Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/libraries/core/ConfigurablePaths.h @ 10916

Last change on this file since 10916 was 10624, checked in by landauf, 9 years ago

merged branch core7 back to trunk

  • Property svn:eol-style set to native
File size: 3.9 KB
RevLine 
[1505]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:
[2896]23 *      Reto Grieder
[1505]24 *   Co-authors:
[2896]25 *      ...
[1505]26 *
27 */
28
[7401]29/**
30    @file
31    @ingroup Management Resources
32*/
33
[10509]34#ifndef _ConfigurablePaths_H__
35#define _ConfigurablePaths_H__
[1505]36
37#include "CorePrereqs.h"
38
[5836]39#include <string>
[3370]40#include "util/Singleton.h"
[1505]41
[6417]42//tolua_begin
[1505]43namespace orxonox
44{
[6417]45//tolua_end
[3196]46    /**
47    @brief
[10509]48        The ConfigurablePaths class is a singleton used to configure different paths.
[3196]49    @details
[10509]50        The class provides information about the data, config, and log path.
[5836]51    @remarks
52        Not all paths are always available:
53        - externalData only for development builds in the build tree
[3196]54    */
[10509]55    class _CoreExport ConfigurablePaths //tolua_export
56        : public Singleton<ConfigurablePaths>
[6417]57    { //tolua_export
[10509]58        friend class Singleton<ConfigurablePaths>;
[3370]59
[1505]60        public:
[10509]61            ConfigurablePaths();
62            ~ConfigurablePaths();
[2896]63
[5695]64            //! Returns the path to the data files as boost::filesystem::path
[5836]65            static const boost::filesystem::path& getDataPath()
66                { return getInstance().dataPath_; }
[5695]67            //! Returns the path to the external data files as boost::filesystem::path
[5836]68            static const boost::filesystem::path& getExternalDataPath()
69                { return getInstance().externalDataPath_; }
[3196]70            //! Returns the path to the config files as boost::filesystem::path
[5836]71            static const boost::filesystem::path& getConfigPath()
72                { return getInstance().configPath_; }
[3196]73            //! Returns the path to the log files as boost::filesystem::path
[5836]74            static const boost::filesystem::path& getLogPath()
75                { return getInstance().logPath_; }
76
[3196]77            //! Returns the path to the data files as std::string
[5695]78            static std::string getDataPathString();
79            //! Returns the path to the external data files as std::string
80            static std::string getExternalDataPathString();
[3196]81            //! Returns the path to the config files as std::string
[6417]82            static std::string getConfigPathString(); //tolua_export
[3196]83            //! Returns the path to the log files as std::string
[2710]84            static std::string getLogPathString();
85
[5836]86            /**
87            @brief
88                Sets config, log and media path and creates the folders if necessary.
89            @throws
90                GeneralException
91            */
[10509]92            void setConfigurablePaths(const ApplicationPaths& applicationPaths);
[2896]93
[10509]94        private:
95            ConfigurablePaths(const ConfigurablePaths&); //!< Don't use (undefined symbol)
96
[5836]97            boost::filesystem::path& dataPath_;              //!< Path to the data files folder
98            boost::filesystem::path& externalDataPath_;      //!< Path to the external data files folder
99            boost::filesystem::path& configPath_;            //!< Path to the config files folder
100            boost::filesystem::path& logPath_;               //!< Path to the log files folder
[2710]101
[10509]102            static ConfigurablePaths* singletonPtr_s;
[6417]103    }; //tolua_export
104} //tolua_export
[1505]105
[10509]106#endif /* _ConfigurablePaths_H__ */
Note: See TracBrowser for help on using the repository browser.