| 77531130 |
Poul Sander |
2016-02-17 18:42 |
1 |
/* |
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
2 |
Its is under the MIT license, to encourage reuse by cut-and-paste. |
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
3 |
|
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
4 |
The original files are hosted here: https://github.com/sago007/PlatformFolders |
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
5 |
|
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
6 |
Copyright (c) 2015 Poul Sander |
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
7 |
|
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
8 |
Permission is hereby granted, free of charge, to any person |
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
9 |
obtaining a copy of this software and associated documentation files |
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
10 |
(the "Software"), to deal in the Software without restriction, |
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
11 |
including without limitation the rights to use, copy, modify, merge, |
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
12 |
publish, distribute, sublicense, and/or sell copies of the Software, |
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
13 |
and to permit persons to whom the Software is furnished to do so, |
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
14 |
subject to the following conditions: |
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
15 |
|
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
16 |
The above copyright notice and this permission notice shall be |
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
17 |
included in all copies or substantial portions of the Software. |
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
18 |
|
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
19 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
20 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
21 |
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
22 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
23 |
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
24 |
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
25 |
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 47fef8e8 |
sago007 |
2016-11-24 21:37 |
26 |
SOFTWARE. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
27 |
*/ |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
28 |
|
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
29 |
#ifndef SAGO_PLATFORM_FOLDERS_H |
| 55ea55dd |
sago007 |
2018-03-24 16:07 |
30 |
#define SAGO_PLATFORM_FOLDERS_H |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
31 |
|
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
32 |
#include <vector> |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
33 |
#include <string> |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
34 |
|
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
35 |
/** |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
36 |
* The namespace I use for common function. Nothing special about it. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
37 |
*/ |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
38 |
namespace sago { |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
39 |
|
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
40 |
#ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
41 |
namespace internal { |
| 8c606ab0 |
Poul Sander |
2019-05-22 18:12 |
42 |
#if !defined(_WIN32) && !defined(__APPLE__) |
| 8c606ab0 |
Poul Sander |
2019-05-22 18:12 |
43 |
void appendExtraFoldersTokenizer(const char* envName, const char* envValue, std::vector<std::string>& folders); |
| 8c606ab0 |
Poul Sander |
2019-05-22 18:12 |
44 |
#endif |
| 8c606ab0 |
Poul Sander |
2019-05-22 18:12 |
45 |
#ifdef _WIN32 |
| 8c606ab0 |
Poul Sander |
2019-05-22 18:12 |
46 |
std::string win32_utf16_to_utf8(const wchar_t* wstr); |
| 8c606ab0 |
Poul Sander |
2019-05-22 18:12 |
47 |
#endif |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
48 |
} |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
49 |
#endif //DOXYGEN_SHOULD_SKIP_THIS |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
50 |
|
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
51 |
/** |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
52 |
* Retrives the base folder for storing data files. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
53 |
* You must add the program name yourself like this: |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
54 |
* @code{.cpp} |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
55 |
* string data_home = getDataHome()+"/My Program Name/"; |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
56 |
* @endcode |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
57 |
* On Windows this defaults to %APPDATA% (Roaming profile) |
| 5bd8105f |
Poul Sander |
2022-02-12 18:15 |
58 |
* On Linux this defaults to ~/.local/share but can be configured by the user |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
59 |
* @return The base folder for storing program data. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
60 |
*/ |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
61 |
std::string getDataHome(); |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
62 |
|
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
63 |
/** |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
64 |
* Retrives the base folder for storing config files. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
65 |
* You must add the program name yourself like this: |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
66 |
* @code{.cpp} |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
67 |
* string data_home = getConfigHome()+"/My Program Name/"; |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
68 |
* @endcode |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
69 |
* On Windows this defaults to %APPDATA% (Roaming profile) |
| 5bd8105f |
Poul Sander |
2022-02-12 18:15 |
70 |
* On Linux this defaults to ~/.config but can be configured by the user |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
71 |
* @return The base folder for storing config data. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
72 |
*/ |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
73 |
std::string getConfigHome(); |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
74 |
|
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
75 |
/** |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
76 |
* Retrives the base folder for storing cache files. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
77 |
* You must add the program name yourself like this: |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
78 |
* @code{.cpp} |
| 5bd8105f |
Poul Sander |
2022-02-12 18:15 |
79 |
* string data_home = getCacheDir()+"/My Program Name/cache/"; |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
80 |
* @endcode |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
81 |
* On Windows this defaults to %APPDATALOCAL% |
| 5bd8105f |
Poul Sander |
2022-02-12 18:15 |
82 |
* On Linux this defaults to ~/.cache but can be configured by the user |
| 5bd8105f |
Poul Sander |
2022-02-12 18:15 |
83 |
* Note that it is recommended to append "cache" after the program name to prevent conflicting with "StateDir" under Windows |
| 5bd8105f |
Poul Sander |
2022-02-12 18:15 |
84 |
* @return The base folder for storing data that do not need to be backed up and might be deleted. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
85 |
*/ |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
86 |
std::string getCacheDir(); |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
87 |
|
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
88 |
/** |
| 5bd8105f |
Poul Sander |
2022-02-12 18:15 |
89 |
* Retrives the base folder used for state files. |
| 5bd8105f |
Poul Sander |
2022-02-12 18:15 |
90 |
* You must add the program name yourself like this: |
| 5bd8105f |
Poul Sander |
2022-02-12 18:15 |
91 |
* @code{.cpp} |
| 5bd8105f |
Poul Sander |
2022-02-12 18:15 |
92 |
* string data_home = getStateDir()+"/My Program Name/"; |
| 5bd8105f |
Poul Sander |
2022-02-12 18:15 |
93 |
* @endcode |
| 5bd8105f |
Poul Sander |
2022-02-12 18:15 |
94 |
* On Windows this defaults to %APPDATALOCAL% |
| 5bd8105f |
Poul Sander |
2022-02-12 18:15 |
95 |
* On Linux this defaults to ~/.local/state but can be configured by the user |
| 5bd8105f |
Poul Sander |
2022-02-12 18:15 |
96 |
* On OS X this is the same as getDataHome() |
| 5bd8105f |
Poul Sander |
2022-02-12 18:15 |
97 |
* @return The base folder for storing data that do not need to be backed up but should not be reguarly deleted either. |
| 5bd8105f |
Poul Sander |
2022-02-12 18:15 |
98 |
*/ |
| 5bd8105f |
Poul Sander |
2022-02-12 18:15 |
99 |
std::string getStateDir(); |
| 5bd8105f |
Poul Sander |
2022-02-12 18:15 |
100 |
|
| 5bd8105f |
Poul Sander |
2022-02-12 18:15 |
101 |
/** |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
102 |
* This will append extra folders that your program should be looking for data files in. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
103 |
* This does not normally include the path returned by GetDataHome(). |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
104 |
* If you want all the folders you should do something like: |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
105 |
* @code{.cpp} |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
106 |
* vector<string> folders; |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
107 |
* folders.push_back(getDataHome()); |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
108 |
* appendAdditionalDataDirectories(folders); |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
109 |
* for (string s& : folders) { |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
110 |
* s+="/My Program Name/"; |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
111 |
* } |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
112 |
* @endcode |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
113 |
* You must apply "/My Program Name/" to all the strings. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
114 |
* The string at the lowest index has the highest priority. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
115 |
* @param homes A vector that extra folders will be appended to. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
116 |
*/ |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
117 |
void appendAdditionalDataDirectories(std::vector<std::string>& homes); |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
118 |
|
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
119 |
/** |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
120 |
* This will append extra folders that your program should be looking for config files in. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
121 |
* This does not normally include the path returned by GetConfigHome(). |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
122 |
* If you want all the folders you should do something like: |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
123 |
* @code{.cpp} |
| f7573b59 |
sago007 |
2016-10-08 17:11 |
124 |
* std::vector<std::string> folders; |
| f7573b59 |
sago007 |
2016-10-08 17:11 |
125 |
* folders.push_back(sago::getConfigHome()); |
| f7573b59 |
sago007 |
2016-10-08 17:11 |
126 |
* sago::appendAdditionalConfigDirectories(folders); |
| f7573b59 |
sago007 |
2016-10-08 17:11 |
127 |
* for (std::string s& : folders) { |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
128 |
* s+="/My Program Name/"; |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
129 |
* } |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
130 |
* @endcode |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
131 |
* You must apply "/My Program Name/" to all the strings. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
132 |
* The string at the lowest index has the highest priority. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
133 |
* @param homes A vector that extra folders will be appended to. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
134 |
*/ |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
135 |
void appendAdditionalConfigDirectories(std::vector<std::string>& homes); |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
136 |
|
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
137 |
/** |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
138 |
* The folder that represents the desktop. |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
139 |
* Normally you should try not to use this folder. |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
140 |
* @return Absolute path to the user's desktop |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
141 |
*/ |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
142 |
std::string getDesktopFolder(); |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
143 |
|
| 0494de59 |
sago007 |
2018-06-03 19:32 |
144 |
/** |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
145 |
* The folder to store user documents to |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
146 |
* @return Absolute path to the "Documents" folder |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
147 |
*/ |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
148 |
std::string getDocumentsFolder(); |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
149 |
|
| 0494de59 |
sago007 |
2018-06-03 19:32 |
150 |
/** |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
151 |
* The folder where files are downloaded. |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
152 |
* @return Absolute path to the folder where files are downloaded to. |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
153 |
*/ |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
154 |
std::string getDownloadFolder(); |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
155 |
|
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
156 |
/** |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
157 |
* The folder where files are downloaded. |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
158 |
* @note This is provided for backward compatibility. Use getDownloadFolder instead. |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
159 |
* @return Absolute path to the folder where files are downloaded to. |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
160 |
*/ |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
161 |
std::string getDownloadFolder1(); |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
162 |
|
| 0494de59 |
sago007 |
2018-06-03 19:32 |
163 |
/** |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
164 |
* The folder for storing the user's pictures. |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
165 |
* @return Absolute path to the "Picture" folder |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
166 |
*/ |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
167 |
std::string getPicturesFolder(); |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
168 |
|
| 0494de59 |
sago007 |
2018-06-03 19:32 |
169 |
/** |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
170 |
* This returns the folder that can be used for sharing files with other users on the same system. |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
171 |
* @return Absolute path to the "Public" folder |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
172 |
*/ |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
173 |
std::string getPublicFolder(); |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
174 |
|
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
175 |
/** |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
176 |
* The folder where music is stored |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
177 |
* @return Absolute path to the music folder |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
178 |
*/ |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
179 |
std::string getMusicFolder(); |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
180 |
|
| 0494de59 |
sago007 |
2018-06-03 19:32 |
181 |
/** |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
182 |
* The folder where video is stored |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
183 |
* @return Absolute path to the video folder |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
184 |
*/ |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
185 |
std::string getVideoFolder(); |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
186 |
|
| 0494de59 |
sago007 |
2018-06-03 19:32 |
187 |
/** |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
188 |
* A base folder for storing saved games. |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
189 |
* You must add the program name to it like this: |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
190 |
* @code{.cpp} |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
191 |
* string saved_games_folder = sago::getSaveGamesFolder1()+"/My Program Name/"; |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
192 |
* @endcode |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
193 |
* @note Windows: This is an XP compatible version and returns the path to "My Games" in Documents. Vista and later has an official folder. |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
194 |
* @note Linux: XDF does not define a folder for saved games. This will just return the same as GetDataHome() |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
195 |
* @return The folder base folder for storing save games. |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
196 |
*/ |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
197 |
std::string getSaveGamesFolder1(); |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
198 |
|
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
199 |
/** |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
200 |
* A base folder for storing saved games. |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
201 |
* You must add the program name to it like this: |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
202 |
* @code{.cpp} |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
203 |
* string saved_games_folder = sago::getSaveGamesFolder2()+"/My Program Name/"; |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
204 |
* @endcode |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
205 |
* @note PlatformFolders provide different folders to for saved games as not all operating systems has support for Saved Games yet. |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
206 |
* It is recommended to pick the highest number (currently getSaveGamesFolder2) at the time your product enters production and stick with it |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
207 |
* @note Windows: This returns the "Saved Games" folder. This folder exist in Vista and later |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
208 |
* @note Linux: XDF does not define a folder for saved games. This will just return the same as GetDataHome() |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
209 |
* @return The folder base folder for storing save games. |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
210 |
*/ |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
211 |
std::string getSaveGamesFolder2(); |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
212 |
|
| 0494de59 |
sago007 |
2018-06-03 19:32 |
213 |
#ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
214 |
|
| 0494de59 |
sago007 |
2018-06-03 19:32 |
215 |
/** |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
216 |
* This class contains methods for finding the system depended special folders. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
217 |
* For Windows these folders are either by convention or given by CSIDL. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
218 |
* For Linux XDG convention is used. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
219 |
* The Linux version has very little error checking and assumes that the config is correct |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
220 |
*/ |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
221 |
class PlatformFolders { |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
222 |
public: |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
223 |
PlatformFolders(); |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
224 |
~PlatformFolders(); |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
225 |
/** |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
226 |
* The folder that represents the desktop. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
227 |
* Normally you should try not to use this folder. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
228 |
* @return Absolute path to the user's desktop |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
229 |
*/ |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
230 |
std::string getDesktopFolder() const; |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
231 |
/** |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
232 |
* The folder to store user documents to |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
233 |
* @return Absolute path to the "Documents" folder |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
234 |
*/ |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
235 |
std::string getDocumentsFolder() const; |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
236 |
/** |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
237 |
* The folder for storing the user's pictures. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
238 |
* @return Absolute path to the "Picture" folder |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
239 |
*/ |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
240 |
std::string getPicturesFolder() const; |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
241 |
/** |
| 8c606ab0 |
Poul Sander |
2019-05-22 18:12 |
242 |
* Use sago::getPublicFolder() instead! |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
243 |
*/ |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
244 |
std::string getPublicFolder() const; |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
245 |
/** |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
246 |
* The folder where files are downloaded. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
247 |
* @note Windows: This version is XP compatible and returns the Desktop. Vista and later has a dedicated folder. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
248 |
* @return Absolute path to the folder where files are downloaded to. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
249 |
*/ |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
250 |
std::string getDownloadFolder1() const; |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
251 |
/** |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
252 |
* The folder where music is stored |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
253 |
* @return Absolute path to the music folder |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
254 |
*/ |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
255 |
std::string getMusicFolder() const; |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
256 |
/** |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
257 |
* The folder where video is stored |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
258 |
* @return Absolute path to the video folder |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
259 |
*/ |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
260 |
std::string getVideoFolder() const; |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
261 |
/** |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
262 |
* The base folder for storing saved games. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
263 |
* You must add the program name to it like this: |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
264 |
* @code{.cpp} |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
265 |
* PlatformFolders pf; |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
266 |
* string saved_games_folder = pf.getSaveGamesFolder1()+"/My Program Name/"; |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
267 |
* @endcode |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
268 |
* @note Windows: This is an XP compatible version and returns the path to "My Games" in Documents. Vista and later has an official folder. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
269 |
* @note Linux: XDF does not define a folder for saved games. This will just return the same as GetDataHome() |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
270 |
* @return The folder base folder for storing save games. |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
271 |
*/ |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
272 |
std::string getSaveGamesFolder1() const; |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
273 |
private: |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
274 |
PlatformFolders(const PlatformFolders&); |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
275 |
PlatformFolders& operator=(const PlatformFolders&); |
| 6b427a55 |
Poul Sander |
2019-02-13 17:49 |
276 |
#if !defined(_WIN32) && !defined(__APPLE__) |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
277 |
struct PlatformFoldersData; |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
278 |
PlatformFoldersData* data; |
| 55ea55dd |
sago007 |
2018-03-24 16:07 |
279 |
#endif |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
280 |
}; |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
281 |
|
| 0494de59 |
sago007 |
2018-06-03 19:32 |
282 |
#endif // skip doxygen |
| 0494de59 |
sago007 |
2018-06-03 19:32 |
283 |
|
| 0494de59 |
sago007 |
2018-06-03 19:32 |
284 |
|
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
285 |
} //namespace sago |
| 77531130 |
Poul Sander |
2016-02-17 18:42 |
286 |
|
| 55ea55dd |
sago007 |
2018-03-24 16:07 |
287 |
#endif /* PLATFORM_FOLDERS_H */ |
|
|
1970-01-01 00:00 |
288 |
|