Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 30, 2015, 12:22:27 PM (9 years ago)
Author:
landauf
Message:

moved static application paths (root, executable, modules) into new class named ApplicationPaths
moved configurable data paths (data, log, config) into new class named ConfigurablePaths
removed PathConfig

File:
1 moved

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/libraries/core/ConfigurablePaths.h

    r10457 r10509  
    3232*/
    3333
    34 #ifndef _PathConfig_H__
    35 #define _PathConfig_H__
     34#ifndef _ConfigurablePaths_H__
     35#define _ConfigurablePaths_H__
    3636
    3737#include "CorePrereqs.h"
    3838
    3939#include <string>
    40 #include <vector>
    4140#include "util/Singleton.h"
    4241
     
    4746    /**
    4847    @brief
    49         The PathConfig class is a singleton used to configure different paths.
     48        The ConfigurablePaths class is a singleton used to configure different paths.
    5049    @details
    51         The class provides information about the data, config, log, executable,
    52         root and module path.
    53         It determines those by the use of platform specific functions.
     50        The class provides information about the data, config, and log path.
    5451    @remarks
    5552        Not all paths are always available:
    56         - root only when installed copyable
    5753        - externalData only for development builds in the build tree
    5854    */
    59     class _CoreExport PathConfig //tolua_export
    60         : public Singleton<PathConfig>
     55    class _CoreExport ConfigurablePaths //tolua_export
     56        : public Singleton<ConfigurablePaths>
    6157    { //tolua_export
    62         friend class Singleton<PathConfig>;
    63         friend class Core;
     58        friend class Singleton<ConfigurablePaths>;
    6459
    6560        public:
    66             /**
    67             @brief
    68                 Retrieves the executable path and sets all hard coded fixed paths (currently only the module path)
    69                 Also checks for "orxonox_dev_build.keep_me" in the executable diretory.
    70                 If found it means that this is not an installed run, hence we
    71                 don't write the logs and config files to ~/.orxonox
    72             @throw
    73                 GeneralException
    74             */
    75             PathConfig();
    76             ~PathConfig();
     61            ConfigurablePaths();
     62            ~ConfigurablePaths();
    7763
    78             //! Returns the path to the root folder as boost::filesystem::path
    79             static const boost::filesystem::path& getRootPath()
    80                 { return getInstance().rootPath_; }
    81             //! Returns the path to the executable folder as boost::filesystem::path
    82             static const boost::filesystem::path& getExecutablePath()
    83                 { return getInstance().executablePath_; }
    8464            //! Returns the path to the data files as boost::filesystem::path
    8565            static const boost::filesystem::path& getDataPath()
     
    9474            static const boost::filesystem::path& getLogPath()
    9575                { return getInstance().logPath_; }
    96             //! Returns the path to the modules as boost::filesystem::path
    97             static const boost::filesystem::path& getModulePath()
    98                 { return getInstance().modulePath_; }
    9976
    100             //! Returns the path to the root folder as std::string
    101             static std::string getRootPathString();
    102             //! Returns the path to the executable folder as std::string
    103             static std::string getExecutablePathString();
    10477            //! Returns the path to the data files as std::string
    10578            static std::string getDataPathString();
     
    11083            //! Returns the path to the log files as std::string
    11184            static std::string getLogPathString();
    112             //! Returns the path to the modules as std::string
    113             static std::string getModulePathString();
    114 
    115             //! Return true for runs in the build directory (not installed)
    116             static bool buildDirectoryRun() { return getInstance().bBuildDirectoryRun_; }
    117 
    118         private:
    119             PathConfig(const PathConfig&); //!< Don't use (undefined symbol)
    12085
    12186            /**
     
    12590                GeneralException
    12691            */
    127             void setConfigurablePaths();
    128             //! Returns a list with all modules declared by a *.module file in the module folder.
    129             std::vector<std::string> getModulePaths();
     92            void setConfigurablePaths(const ApplicationPaths& applicationPaths);
    13093
    131             //! Path to the parent directory of the ones above if program was installed with relative paths
    132             boost::filesystem::path& rootPath_;
    133             boost::filesystem::path& executablePath_;        //!< Path to the executable
    134             boost::filesystem::path& modulePath_;            //!< Path to the modules
     94        private:
     95            ConfigurablePaths(const ConfigurablePaths&); //!< Don't use (undefined symbol)
     96
    13597            boost::filesystem::path& dataPath_;              //!< Path to the data files folder
    13698            boost::filesystem::path& externalDataPath_;      //!< Path to the external data files folder
     
    138100            boost::filesystem::path& logPath_;               //!< Path to the log files folder
    139101
    140             bool                     bBuildDirectoryRun_;    //!< True for runs in the build directory (not installed)
    141             static PathConfig* singletonPtr_s;
     102            static ConfigurablePaths* singletonPtr_s;
    142103    }; //tolua_export
    143104} //tolua_export
    144105
    145 #endif /* _PathConfig_H__ */
     106#endif /* _ConfigurablePaths_H__ */
Note: See TracChangeset for help on using the changeset viewer.