OpenMW
components/files/fixedpath.hpp
Go to the documentation of this file.
00001 #ifndef COMPONENTS_FILES_FIXEDPATH_HPP
00002 #define COMPONENTS_FILES_FIXEDPATH_HPP
00003 
00004 #include <string>
00005 #include <boost/filesystem.hpp>
00006 
00007 #if defined(__linux__) || defined(__FreeBSD__)
00008     #include <components/files/linuxpath.hpp>
00009     namespace Files { typedef LinuxPath TargetPathType; }
00010 
00011 #elif defined(__WIN32) || defined(__WINDOWS__) || defined(_WIN32)
00012     #include <components/files/windowspath.hpp>
00013     namespace Files { typedef WindowsPath TargetPathType; }
00014 
00015 #elif defined(macintosh) || defined(Macintosh) || defined(__APPLE__) || defined(__MACH__)
00016     #include <components/files/macospath.hpp>
00017     namespace Files { typedef MacOsPath TargetPathType; }
00018 
00019 #else
00020     #error "Unknown platform!"
00021 #endif
00022 
00023 
00027 namespace Files
00028 {
00029 
00036 template
00037 <
00038     class P = TargetPathType
00039 >
00040 struct FixedPath
00041 {
00042     typedef P PathType;
00043 
00049     FixedPath(const std::string& application_name)
00050         : mPath(application_name + "/")
00051         , mUserConfigPath(mPath.getUserConfigPath())
00052         , mUserDataPath(mPath.getUserDataPath())
00053         , mGlobalConfigPath(mPath.getGlobalConfigPath())
00054         , mLocalPath(mPath.getLocalPath())
00055         , mGlobalDataPath(mPath.getGlobalDataPath())
00056         , mInstallPath(mPath.getInstallPath())
00057         , mCachePath(mPath.getCachePath())
00058     {
00059     }
00060 
00064     const boost::filesystem::path& getUserConfigPath() const
00065     {
00066         return mUserConfigPath;
00067     }
00068 
00069     const boost::filesystem::path& getUserDataPath() const
00070     {
00071         return mUserDataPath;
00072     }
00073 
00077     const boost::filesystem::path& getGlobalConfigPath() const
00078     {
00079         return mGlobalConfigPath;
00080     }
00081 
00085     const boost::filesystem::path& getLocalPath() const
00086     {
00087         return mLocalPath;
00088     }
00089 
00090     const boost::filesystem::path& getInstallPath() const
00091     {
00092         return mInstallPath;
00093     }
00094 
00095     const boost::filesystem::path& getGlobalDataPath() const
00096     {
00097         return mGlobalDataPath;
00098     }
00099 
00100     const boost::filesystem::path& getCachePath() const
00101     {
00102         return mCachePath;
00103     }
00104 
00105     private:
00106         PathType mPath;
00107 
00108         boost::filesystem::path mUserConfigPath;       
00109         boost::filesystem::path mUserDataPath;
00110         boost::filesystem::path mGlobalConfigPath;     
00111         boost::filesystem::path mLocalPath;      
00113         boost::filesystem::path mGlobalDataPath;        
00115         boost::filesystem::path mCachePath;
00116 
00117         boost::filesystem::path mInstallPath;
00118 
00119 };
00120 
00121 
00122 } /* namespace Files */
00123 
00124 #endif /* COMPONENTS_FILES_FIXEDPATH_HPP */