]>
Commit | Line | Data |
---|---|---|
1ee445c7 | 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
96e2aec5 VZ |
2 | %% Name: stdpaths.tex |
3 | %% Purpose: wxStandardPaths documentation | |
1ee445c7 VZ |
4 | %% Author: Vadim Zeitlin |
5 | %% Modified by: | |
6 | %% Created: 2004-10-17 | |
7 | %% RCS-ID: $Id$ | |
8 | %% Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org> | |
8795498c | 9 | %% License: wxWindows license |
1ee445c7 VZ |
10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
11 | ||
48713afd | 12 | \section{\class{wxStandardPaths}}\label{wxstandardpaths} |
1ee445c7 | 13 | |
96e2aec5 | 14 | wxStandardPaths returns the standard locations in the file system and should be |
dceb1c09 | 15 | used by applications to find their data files in a portable way. |
1ee445c7 | 16 | |
1ee445c7 VZ |
17 | In the description of the methods below, the example return values are given |
18 | for the Unix, Windows and Mac OS X systems, however please note that these are | |
48713afd VZ |
19 | just the examples and the actual values may differ. For example, under Windows: |
20 | the system administrator may change the standard directories locations, i.e. | |
21 | the Windows directory may be named \texttt{W:$\backslash$Win2003} instead of | |
22 | the default \texttt{C:$\backslash$Windows}. | |
1ee445c7 VZ |
23 | |
24 | The strings \texttt{\textit{appname}} and \texttt{\textit{username}} should be | |
6cd6ec63 WS |
25 | replaced with the value returned by \helpref{wxApp::GetAppName}{wxappgetappname} |
26 | and the name of the currently logged in user, respectively. The string | |
48713afd VZ |
27 | \texttt{\textit{prefix}} is only used under Unix and is \texttt{/usr/local} by |
28 | default but may be changed using \helpref{SetInstallPrefix}{wxstandardpathssetinstallprefix}. | |
1ee445c7 VZ |
29 | |
30 | The directories returned by the methods of this class may or may not exist. If | |
96e2aec5 | 31 | they don't exist, it's up to the caller to create them, wxStandardPaths doesn't |
1ee445c7 VZ |
32 | do it. |
33 | ||
48713afd VZ |
34 | Finally note that these functions only work with standardly packaged |
35 | applications. I.e. under Unix you should follow the standard installation | |
36 | conventions and under Mac you should create your application bundle according | |
37 | to the Apple guidelines. Again, this class doesn't help you to do it. | |
1ee445c7 | 38 | |
b36d022a VZ |
39 | This class is MT-safe: its methods may be called concurrently from different |
40 | threads without additional locking. | |
41 | ||
1ee445c7 VZ |
42 | \wxheading{Derived from} |
43 | ||
44 | No base class | |
45 | ||
46 | \wxheading{Include files} | |
47 | ||
08acda4f | 48 | <wx/stdpaths.h> |
1ee445c7 | 49 | |
a7af285d VZ |
50 | \wxheading{Library} |
51 | ||
52 | \helpref{wxBase}{librarieslist} | |
53 | ||
1ee445c7 VZ |
54 | |
55 | \latexignore{\rtfignore{\wxheading{Members}}} | |
56 | ||
57 | ||
effdccd8 VZ |
58 | \membersection{wxStandardPaths::Get}\label{wxstandardpathsget} |
59 | ||
8648883b | 60 | \func{static wxStandardPathsBase\&}{Get}{\void} |
effdccd8 VZ |
61 | |
62 | Returns reference to the unique global standard paths object. | |
63 | ||
64 | ||
48713afd | 65 | \membersection{wxStandardPaths::GetConfigDir}\label{wxstandardpathsgetconfigdir} |
1ee445c7 | 66 | |
ecf9559d | 67 | \constfunc{wxString}{GetConfigDir}{\void} |
1ee445c7 VZ |
68 | |
69 | Return the directory containing the system config files. | |
70 | ||
71 | Example return values: | |
72 | \begin{itemize} | |
73 | \item Unix: \texttt{/etc} | |
b36d022a | 74 | \item Windows: \texttt{C:$\backslash$Documents and Settings$\backslash$All Users$\backslash$Application Data} |
1ee445c7 VZ |
75 | \item Mac: \texttt{/Library/Preferences} |
76 | \end{itemize} | |
77 | ||
78 | \wxheading{See also} | |
79 | ||
80 | \helpref{wxFileConfig}{wxfileconfig} | |
81 | ||
82 | ||
48713afd | 83 | \membersection{wxStandardPaths::GetDataDir}\label{wxstandardpathsgetdatadir} |
1ee445c7 | 84 | |
ecf9559d | 85 | \constfunc{wxString}{GetDataDir}{\void} |
1ee445c7 VZ |
86 | |
87 | Return the location of the applications global, i.e. not user-specific, | |
88 | data files. | |
89 | ||
90 | Example return values: | |
91 | \begin{itemize} | |
48713afd | 92 | \item Unix: \texttt{\textit{prefix}/share/\textit{appname}} |
90537299 | 93 | \item Windows: the directory where the executable file is located |
48713afd | 94 | \item Mac: \texttt{\textit{appname}.app/Contents/SharedSupport} bundle subdirectory |
1ee445c7 VZ |
95 | \end{itemize} |
96 | ||
97 | \wxheading{See also} | |
98 | ||
48713afd VZ |
99 | \helpref{GetLocalDataDir}{wxstandardpathsgetlocaldatadir} |
100 | ||
101 | ||
17af82fb VZ |
102 | \membersection{wxStandardPaths::GetDocumentsDir}\label{wxstandardpathsgetdocumentsdir} |
103 | ||
ecf9559d | 104 | \constfunc{wxString}{GetDocumentsDir}{\void} |
17af82fb VZ |
105 | |
106 | Return the directory containing the current user's documents. | |
107 | ||
108 | Example return values: | |
109 | \begin{itemize} | |
110 | \item Unix: \tt{~} (the home directory) | |
111 | \item Windows: \texttt{C:$\backslash$Documents and Settings$\backslash$\textit{username}$\backslash$Documents} | |
112 | \item Mac: \texttt{~/Documents} | |
113 | \end{itemize} | |
114 | ||
a06ee288 MR |
115 | \newsince{2.7.0} |
116 | ||
17af82fb | 117 | |
ac7ad70d RR |
118 | \membersection{wxStandardPaths::GetExecutablePath}\label{wxstandardpathsgetexecutablepath} |
119 | ||
120 | \constfunc{wxString}{GetExecutablePath}{\void} | |
121 | ||
122 | Return the directory and the filename for the current executable. | |
123 | ||
124 | Example return values: | |
125 | \begin{itemize} | |
126 | \item Unix: \texttt{/usr/local/bin/exename} | |
127 | \item Windows: \texttt{C:$\backslash$Programs$\backslash$AppFolder$\backslash$exename.exe} | |
128 | \item Mac: \texttt{/Programs/exename} | |
129 | \end{itemize} | |
130 | ||
131 | ||
132 | ||
48713afd VZ |
133 | \membersection{wxStandardPaths::GetInstallPrefix}\label{wxstandardpathsgetinstallprefix} |
134 | ||
ecf9559d | 135 | \constfunc{wxString}{GetInstallPrefix}{\void} |
48713afd VZ |
136 | |
137 | \textbf{Note: } This function is only available under Unix. | |
138 | ||
6cd6ec63 | 139 | Return the program installation prefix, e.g. \texttt{/usr}, \texttt{/opt} or |
48713afd | 140 | \texttt{/home/zeitlin}. |
1ee445c7 | 141 | |
6cd6ec63 | 142 | If the prefix had been previously by |
48713afd VZ |
143 | \helpref{SetInstallPrefix}{wxstandardpathssetinstallprefix}, returns that |
144 | value, otherwise tries to determine it automatically (Linux only right | |
145 | now) and finally returns the default \texttt{/usr/local} value if it failed. | |
1ee445c7 | 146 | |
48713afd VZ |
147 | |
148 | \membersection{wxStandardPaths::GetLocalDataDir}\label{wxstandardpathsgetlocaldatadir} | |
1ee445c7 | 149 | |
ecf9559d | 150 | \constfunc{wxString}{GetLocalDataDir}{\void} |
1ee445c7 VZ |
151 | |
152 | Return the location for application data files which are host-specific and | |
153 | can't, or shouldn't, be shared with the other machines. | |
154 | ||
48713afd | 155 | This is the same as \helpref{GetDataDir()}{wxstandardpathsgetdatadir} except |
1ee445c7 VZ |
156 | under Unix where it returns \texttt{/etc/\textit{appname}}. |
157 | ||
158 | ||
f3b0f8ad VZ |
159 | \membersection{wxStandardPaths::GetLocalizedResourcesDir}\label{wxstandardpathsgetlocalizedresourcesdir} |
160 | ||
e0b3b9d0 | 161 | \constfunc{wxString}{GetLocalizedResourcesDir}{\param{const wxString\&}{ lang}, \param{ResourceCat}{ category = ResourceCat\_None}} |
f3b0f8ad VZ |
162 | |
163 | Return the localized resources directory containing the resource files of the | |
164 | specified category for the given language. | |
165 | ||
6cd6ec63 WS |
166 | In general this is just the same as \arg{lang} subdirectory of |
167 | \helpref{GetResourcesDir()}{wxstandardpathsgetresourcesdir} (or | |
f3b0f8ad | 168 | \texttt{\arg{lang}.lproj} under Mac OS X) but is something quite |
6cd6ec63 | 169 | different for message catalog category under Unix where it returns the standard |
f3b0f8ad VZ |
170 | \texttt{\textit{prefix}/share/locale/\arg{lang}/LC\_MESSAGES} directory. |
171 | ||
a06ee288 MR |
172 | \newsince{2.7.0} |
173 | ||
f3b0f8ad | 174 | |
48713afd | 175 | \membersection{wxStandardPaths::GetPluginsDir}\label{wxstandardpathsgetpluginsdir} |
1ee445c7 | 176 | |
ecf9559d | 177 | \constfunc{wxString}{GetPluginsDir}{\void} |
1ee445c7 VZ |
178 | |
179 | Return the directory where the loadable modules (plugins) live. | |
180 | ||
f3b0f8ad VZ |
181 | Example return values: |
182 | \begin{itemize} | |
afc2d3bc MR |
183 | \item Unix: \texttt{\textit{prefix}/lib/\textit{appname}} |
184 | \item Windows: the directory of the executable file | |
185 | \item Mac: \texttt{\textit{appname}.app/Contents/PlugIns} bundle subdirectory | |
f3b0f8ad VZ |
186 | \end{itemize} |
187 | ||
188 | \wxheading{See also} | |
189 | ||
190 | \helpref{wxDynamicLibrary}{wxdynamiclibrary} | |
191 | ||
192 | ||
193 | \membersection{wxStandardPaths::GetResourcesDir}\label{wxstandardpathsgetresourcesdir} | |
194 | ||
ecf9559d | 195 | \constfunc{wxString}{GetResourcesDir}{\void} |
f3b0f8ad VZ |
196 | |
197 | Return the directory where the application resource files are located. The | |
198 | resources are the auxiliary data files needed for the application to run and | |
199 | include, for example, image and sound files it might use. | |
200 | ||
201 | This function is the same as \helpref{GetDataDir}{wxstandardpathsgetdatadir} for | |
202 | all platforms except Mac OS X. | |
203 | ||
1ee445c7 VZ |
204 | Example return values: |
205 | \begin{itemize} | |
afc2d3bc MR |
206 | \item Unix: \texttt{\textit{prefix}/share/\textit{appname}} |
207 | \item Windows: the directory where the executable file is located | |
208 | \item Mac: \texttt{\textit{appname}.app/Contents/Resources} bundle subdirectory | |
1ee445c7 VZ |
209 | \end{itemize} |
210 | ||
a06ee288 MR |
211 | \newsince{2.7.0} |
212 | ||
213 | ||
1ee445c7 VZ |
214 | \wxheading{See also} |
215 | ||
f3b0f8ad | 216 | \helpref{GetLocalizedResourcesDir}{wxstandardpathsgetlocalizedresourcesdir} |
1ee445c7 | 217 | |
ecf9559d JS |
218 | \membersection{wxStandardPaths::GetTempDir}\label{wxstandardpathsgettempdir} |
219 | ||
220 | \constfunc{wxString}{GetTempDir}{\void} | |
221 | ||
222 | Return the directory for storing temporary files. To create unique temporary files, | |
223 | it is best to use \helpref{wxFileName::CreateTempFileName}{wxfilenamecreatetempfilename} for correct behaviour when | |
224 | multiple processes are attempting to create temporary files. | |
225 | ||
226 | \newsince{2.7.2} | |
1ee445c7 | 227 | |
48713afd | 228 | \membersection{wxStandardPaths::GetUserConfigDir}\label{wxstandardpathsgetuserconfigdir} |
1ee445c7 | 229 | |
ecf9559d | 230 | \constfunc{wxString}{GetUserConfigDir}{\void} |
1ee445c7 VZ |
231 | |
232 | Return the directory for the user config files: | |
233 | \begin{itemize} | |
0d2b62c5 | 234 | \item Unix: \tt{~} (the home directory) |
da557e09 | 235 | \item Windows: \tt{C:$\backslash$Documents and Settings$\backslash$\textit{username}$\backslash$Application Data} |
0d2b62c5 | 236 | \item Mac: \tt{~/Library/Preferences} |
1ee445c7 VZ |
237 | \end{itemize} |
238 | ||
239 | Only use this method if you have a single configuration file to put in this | |
48713afd | 240 | directory, otherwise \helpref{GetUserDataDir()}{wxstandardpathsgetuserdatadir} is |
1ee445c7 VZ |
241 | more appropriate. |
242 | ||
243 | ||
48713afd | 244 | \membersection{wxStandardPaths::GetUserDataDir}\label{wxstandardpathsgetuserdatadir} |
1ee445c7 | 245 | |
ecf9559d | 246 | \constfunc{wxString}{GetUserDataDir}{\void} |
1ee445c7 VZ |
247 | |
248 | Return the directory for the user-dependent application data files: | |
249 | \begin{itemize} | |
0d2b62c5 | 250 | \item Unix: \tt{~/.\textit{appname}} |
6fdd4565 | 251 | \item Windows: \tt{C:$\backslash$Documents and Settings$\backslash$\textit{username}$\backslash$Application Data$\backslash$\textit{appname}} |
0d2b62c5 | 252 | \item Mac: \tt{~/Library/Application Support/\textit{appname}} |
1ee445c7 VZ |
253 | \end{itemize} |
254 | ||
255 | ||
48713afd | 256 | \membersection{wxStandardPaths::GetUserLocalDataDir}\label{wxstandardpathsgetuserlocaldatadir} |
1ee445c7 | 257 | |
ecf9559d | 258 | \constfunc{wxString}{GetUserLocalDataDir}{\void} |
1ee445c7 VZ |
259 | |
260 | Return the directory for user data files which shouldn't be shared with | |
261 | the other machines. | |
262 | ||
48713afd | 263 | This is the same as \helpref{GetUserDataDir()}{wxstandardpathsgetuserdatadir} for |
6cd6ec63 | 264 | all platforms except Windows where it returns |
96e2aec5 | 265 | \texttt{C:$\backslash$Documents and Settings$\backslash$\textit{username}$\backslash$Local Settings$\backslash$Application Data$\backslash$\textit{appname}} |
1ee445c7 VZ |
266 | |
267 | ||
48713afd VZ |
268 | \membersection{wxStandardPaths::SetInstallPrefix}\label{wxstandardpathssetinstallprefix} |
269 | ||
effdccd8 | 270 | \func{void}{SetInstallPrefix}{\param{const wxString\& }{prefix}} |
48713afd | 271 | |
dceb1c09 | 272 | \textbf{Note:} This function is only available under Unix. |
48713afd VZ |
273 | |
274 | Lets wxStandardPaths know about the real program installation prefix on a Unix | |
ac7ad70d | 275 | system. By default, the value returned by |
48713afd VZ |
276 | \helpref{GetInstallPrefix}{wxstandardpathsgetinstallprefix} is used. |
277 | ||
278 | Although under Linux systems the program prefix may usually be determined | |
279 | automatically, portable programs should call this function. Usually the prefix | |
280 | is set during program configuration if using GNU autotools and so it is enough | |
281 | to pass its value defined in \texttt{config.h} to this function. | |
282 | ||
2b147f2e VZ |
283 | |
284 | \membersection{wxStandardPaths::UseAppInfo}\label{wxstandardpathsuseappinfo} | |
285 | ||
286 | \func{void}{UseAppInfo}{\param{int }{info}} | |
287 | ||
288 | Controls what application information is used when constructing paths that | |
289 | should be unique to this program, such as the application data directory, the | |
290 | plugins directory on Unix, etc. | |
291 | ||
292 | Valid values for \arg{info} are \texttt{AppInfo\_None} and either one or | |
293 | combination of \texttt{AppInfo\_AppName} and \texttt{AppInfo\_VendorName}. The | |
294 | first one tells this class to not use neither application nor vendor name in | |
295 | the paths. | |
296 | ||
297 | By default, only the application name is used under Unix systems but both | |
298 | application and vendor names are used under Windows and Mac. | |
299 | ||
300 | \wxheading{See also} | |
301 | ||
302 | \helpref{wxApp::SetAppName}{wxappsetappname}, \helpref{wxApp::SetVendorName}{wxappsetvendorname} | |
303 |