File: SpecialProtocol.h

package info (click to toggle)
kodi 16.1%2Bdfsg1-2~bpo8%2B2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 73,324 kB
  • sloc: cpp: 592,417; xml: 59,388; ansic: 58,092; makefile: 4,978; sh: 4,938; python: 2,936; java: 1,065; perl: 997; objc: 982; cs: 624; asm: 294; sed: 16
file content (84 lines) | stat: -rw-r--r-- 3,452 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#pragma once
/*
 *      Copyright (C) 2005-2013 Team XBMC
 *      http://xbmc.org
 *
 *  This Program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *
 *  This Program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with XBMC; see the file COPYING.  If not, see
 *  <http://www.gnu.org/licenses/>.
 *
 */

#include <map>
#include <string>

// static class for path translation from our special:// URLs.

/* paths are as follows:

 special://xbmc/          - the main XBMC folder (i.e. where the app resides).
 special://home/          - a writeable version of the main XBMC folder
                             Linux: ~/.kodi/
                             OS X:  ~/Library/Application Support/Kodi/
                             Win32: ~/Application Data/XBMC/
 special://userhome/      - a writable version of the user home directory
                             Linux, OS X: ~/.kodi
                             Win32: home directory of user
 special://masterprofile/ - the master users userdata folder - usually special://home/userdata
                             Linux: ~/.kodi/userdata/
                             OS X:  ~/Library/Application Support/Kodi/UserData/
                             Win32: ~/Application Data/XBMC/UserData/
 special://profile/       - the current users userdata folder - usually special://masterprofile/profiles/<current_profile>
                             Linux: ~/.kodi/userdata/profiles/<current_profile>
                             OS X:  ~/Library/Application Support/Kodi/UserData/profiles/<current_profile>
                             Win32: ~/Application Data/XBMC/UserData/profiles/<current_profile>

 special://temp/          - the temporary directory.
                             Linux: ~/.kodi/temp
                             OS X:  ~/
                             Win32: ~/Application Data/XBMC/cache
*/
class CURL;
class CSpecialProtocol
{
public:
  static void SetProfilePath(const std::string &path);
  static void SetXBMCPath(const std::string &path);
  static void SetXBMCBinPath(const std::string &path);
  static void SetXBMCFrameworksPath(const std::string &path);
  static void SetHomePath(const std::string &path);
  static void SetUserHomePath(const std::string &path);
  static void SetMasterProfilePath(const std::string &path);
  static void SetTempPath(const std::string &path);

  static bool ComparePath(const std::string &path1, const std::string &path2);
  static void LogPaths();

  static std::string TranslatePath(const std::string &path);
  static std::string TranslatePath(const CURL &url);
  static std::string TranslatePathConvertCase(const std::string& path);

private:
  static void SetPath(const std::string &key, const std::string &path);
  static std::string GetPath(const std::string &key);

  static std::map<std::string, std::string> m_pathMap;
};

#ifdef TARGET_WINDOWS
#define PATH_SEPARATOR_CHAR '\\'
#define PATH_SEPARATOR_STRING "\\"
#else
#define PATH_SEPARATOR_CHAR '/'
#define PATH_SEPARATOR_STRING "/"
#endif