OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
fixedpath.hpp
Go to the documentation of this file.
1 #ifndef COMPONENTS_FILES_FIXEDPATH_HPP
2 #define COMPONENTS_FILES_FIXEDPATH_HPP
3 
4 #include <string>
5 #include <boost/filesystem.hpp>
6 
7 #if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
8 #ifndef ANDROID
10  namespace Files { typedef LinuxPath TargetPathType; }
11 #else
13  namespace Files { typedef AndroidPath TargetPathType; }
14 #endif
15 #elif defined(__WIN32) || defined(__WINDOWS__) || defined(_WIN32)
17  namespace Files { typedef WindowsPath TargetPathType; }
18 
19 #elif defined(macintosh) || defined(Macintosh) || defined(__APPLE__) || defined(__MACH__)
21  namespace Files { typedef MacOsPath TargetPathType; }
22 
23 #else
24  #error "Unknown platform!"
25 #endif
26 
27 
31 namespace Files
32 {
33 
40 template
41 <
42  class P = TargetPathType
43 >
44 struct FixedPath
45 {
46  typedef P PathType;
47 
53  FixedPath(const std::string& application_name)
54  : mPath(application_name + "/")
62  {
63  }
64 
68  const boost::filesystem::path& getUserConfigPath() const
69  {
70  return mUserConfigPath;
71  }
72 
73  const boost::filesystem::path& getUserDataPath() const
74  {
75  return mUserDataPath;
76  }
77 
81  const boost::filesystem::path& getGlobalConfigPath() const
82  {
83  return mGlobalConfigPath;
84  }
85 
89  const boost::filesystem::path& getLocalPath() const
90  {
91  return mLocalPath;
92  }
93 
94 
95  const boost::filesystem::path& getInstallPath() const
96  {
97  return mInstallPath;
98  }
99 
100  const boost::filesystem::path& getGlobalDataPath() const
101  {
102  return mGlobalDataPath;
103  }
104 
105  const boost::filesystem::path& getCachePath() const
106  {
107  return mCachePath;
108  }
109 
110  private:
112 
113  boost::filesystem::path mUserConfigPath;
114  boost::filesystem::path mUserDataPath;
115  boost::filesystem::path mGlobalConfigPath;
116  boost::filesystem::path mLocalPath;
118  boost::filesystem::path mGlobalDataPath;
120  boost::filesystem::path mCachePath;
121 
122  boost::filesystem::path mInstallPath;
123 
124 };
125 
126 
127 } /* namespace Files */
128 
129 #endif /* COMPONENTS_FILES_FIXEDPATH_HPP */
boost::filesystem::path mCachePath
Definition: fixedpath.hpp:120
PathType mPath
Definition: fixedpath.hpp:111
const boost::filesystem::path & getGlobalConfigPath() const
Return path pointing to the global (system) configuration directory.
Definition: fixedpath.hpp:81
const boost::filesystem::path & getUserConfigPath() const
Return path pointing to the user local configuration directory.
Definition: fixedpath.hpp:68
P PathType
Definition: fixedpath.hpp:46
const boost::filesystem::path & getInstallPath() const
Definition: fixedpath.hpp:95
const boost::filesystem::path & getCachePath() const
Definition: fixedpath.hpp:105
const boost::filesystem::path & getLocalPath() const
Return path pointing to the directory where application was started.
Definition: fixedpath.hpp:89
Definition: fixedpath.hpp:44
boost::filesystem::path mInstallPath
Definition: fixedpath.hpp:122
FixedPath(const std::string &application_name)
Path constructor.
Definition: fixedpath.hpp:53
const boost::filesystem::path & getUserDataPath() const
Definition: fixedpath.hpp:73
boost::filesystem::path mLocalPath
Definition: fixedpath.hpp:116
boost::filesystem::path mGlobalDataPath
Definition: fixedpath.hpp:118
boost::filesystem::path mUserConfigPath
Definition: fixedpath.hpp:113
boost::filesystem::path mUserDataPath
Definition: fixedpath.hpp:114
boost::filesystem::path mGlobalConfigPath
Definition: fixedpath.hpp:115
const boost::filesystem::path & getGlobalDataPath() const
Definition: fixedpath.hpp:100