3 * Copyright (C) 2005-2013 Team XBMC
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)
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.
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/>.
23 #include "utils/StdString.h"
25 // static class for path translation from our special:// URLs.
27 /* paths are as follows:
29 special://xbmc/ - the main XBMC folder (i.e. where the app resides).
30 special://home/ - a writeable version of the main XBMC folder
32 OS X: ~/Library/Application Support/XBMC/
33 Win32: ~/Application Data/XBMC/
34 special://userhome/ - a writable version of the user home directory
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>
46 special://temp/ - the temporary directory.
47 Linux: ~/tmp/xbmc<username>
49 Win32: ~/Application Data/XBMC/cache
52 class CSpecialProtocol
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);
64 static bool ComparePath(const CStdString &path1, const CStdString &path2);
65 static void LogPaths();
67 static CStdString TranslatePath(const CStdString &path);
68 static CStdString TranslatePath(const CURL &url);
69 static CStdString TranslatePathConvertCase(const CStdString& path);
72 static void SetPath(const CStdString &key, const CStdString &path);
73 static CStdString GetPath(const CStdString &key);
75 static std::map<CStdString, CStdString> m_pathMap;
79 #define PATH_SEPARATOR_CHAR '\\'
80 #define PATH_SEPARATOR_STRING "\\"
82 #define PATH_SEPARATOR_CHAR '/'
83 #define PATH_SEPARATOR_STRING "/"