[cosmetics] update date in GPL header
[vuplus_xbmc] / xbmc / filesystem / SpecialProtocol.h
1 #pragma once
2 /*
3  *      Copyright (C) 2005-2013 Team XBMC
4  *      http://www.xbmc.org
5  *
6  *  This Program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2, or (at your option)
9  *  any later version.
10  *
11  *  This Program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with XBMC; see the file COPYING.  If not, see
18  *  <http://www.gnu.org/licenses/>.
19  *
20  */
21
22 #include <map>
23 #include "utils/StdString.h"
24
25 // static class for path translation from our special:// URLs.
26
27 /* paths are as follows:
28
29  special://xbmc/          - the main XBMC folder (i.e. where the app resides).
30  special://home/          - a writeable version of the main XBMC folder
31                              Linux: ~/.xbmc/
32                              OS X:  ~/Library/Application Support/XBMC/
33                              Win32: ~/Application Data/XBMC/
34  special://userhome/      - a writable version of the user home directory
35                              Linux, OS X: ~/.xbmc
36                              Win32: home directory of user
37  special://masterprofile/ - the master users userdata folder - usually special://home/userdata
38                              Linux: ~/.xbmc/userdata/
39                              OS X:  ~/Library/Application Support/XBMC/UserData/
40                              Win32: ~/Application Data/XBMC/UserData/
41  special://profile/       - the current users userdata folder - usually special://masterprofile/profiles/<current_profile>
42                              Linux: ~/.xbmc/userdata/profiles/<current_profile>
43                              OS X:  ~/Library/Application Support/XBMC/UserData/profiles/<current_profile>
44                              Win32: ~/Application Data/XBMC/UserData/profiles/<current_profile>
45
46  special://temp/          - the temporary directory.
47                              Linux: ~/tmp/xbmc<username>
48                              OS X:  ~/
49                              Win32: ~/Application Data/XBMC/cache
50 */
51 class CURL;
52 class CSpecialProtocol
53 {
54 public:
55   static void SetProfilePath(const CStdString &path);
56   static void SetXBMCPath(const CStdString &path);
57   static void SetXBMCBinPath(const CStdString &path);
58   static void SetXBMCFrameworksPath(const CStdString &path);
59   static void SetHomePath(const CStdString &path);
60   static void SetUserHomePath(const CStdString &path);
61   static void SetMasterProfilePath(const CStdString &path);
62   static void SetTempPath(const CStdString &path);
63
64   static bool ComparePath(const CStdString &path1, const CStdString &path2);
65   static void LogPaths();
66
67   static CStdString TranslatePath(const CStdString &path);
68   static CStdString TranslatePath(const CURL &url);
69   static CStdString TranslatePathConvertCase(const CStdString& path);
70
71 private:
72   static void SetPath(const CStdString &key, const CStdString &path);
73   static CStdString GetPath(const CStdString &key);
74
75   static std::map<CStdString, CStdString> m_pathMap;
76 };
77
78 #ifdef _WIN32
79 #define PATH_SEPARATOR_CHAR '\\'
80 #define PATH_SEPARATOR_STRING "\\"
81 #else
82 #define PATH_SEPARATOR_CHAR '/'
83 #define PATH_SEPARATOR_STRING "/"
84 #endif