]>
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 VZ |
49 | |
50 | ||
51 | \latexignore{\rtfignore{\wxheading{Members}}} | |
52 | ||
53 | ||
effdccd8 VZ |
54 | \membersection{wxStandardPaths::Get}\label{wxstandardpathsget} |
55 | ||
8648883b | 56 | \func{static wxStandardPathsBase\&}{Get}{\void} |
effdccd8 VZ |
57 | |
58 | Returns reference to the unique global standard paths object. | |
59 | ||
60 | ||
48713afd | 61 | \membersection{wxStandardPaths::GetConfigDir}\label{wxstandardpathsgetconfigdir} |
1ee445c7 | 62 | |
ecf9559d | 63 | \constfunc{wxString}{GetConfigDir}{\void} |
1ee445c7 VZ |
64 | |
65 | Return the directory containing the system config files. | |
66 | ||
67 | Example return values: | |
68 | \begin{itemize} | |
69 | \item Unix: \texttt{/etc} | |
b36d022a | 70 | \item Windows: \texttt{C:$\backslash$Documents and Settings$\backslash$All Users$\backslash$Application Data} |
1ee445c7 VZ |
71 | \item Mac: \texttt{/Library/Preferences} |
72 | \end{itemize} | |
73 | ||
74 | \wxheading{See also} | |
75 | ||
76 | \helpref{wxFileConfig}{wxfileconfig} | |
77 | ||
78 | ||
48713afd | 79 | \membersection{wxStandardPaths::GetDataDir}\label{wxstandardpathsgetdatadir} |
1ee445c7 | 80 | |
ecf9559d | 81 | \constfunc{wxString}{GetDataDir}{\void} |
1ee445c7 VZ |
82 | |
83 | Return the location of the applications global, i.e. not user-specific, | |
84 | data files. | |
85 | ||
86 | Example return values: | |
87 | \begin{itemize} | |
48713afd | 88 | \item Unix: \texttt{\textit{prefix}/share/\textit{appname}} |
90537299 | 89 | \item Windows: the directory where the executable file is located |
48713afd | 90 | \item Mac: \texttt{\textit{appname}.app/Contents/SharedSupport} bundle subdirectory |
1ee445c7 VZ |
91 | \end{itemize} |
92 | ||
93 | \wxheading{See also} | |
94 | ||
48713afd VZ |
95 | \helpref{GetLocalDataDir}{wxstandardpathsgetlocaldatadir} |
96 | ||
97 | ||
17af82fb VZ |
98 | \membersection{wxStandardPaths::GetDocumentsDir}\label{wxstandardpathsgetdocumentsdir} |
99 | ||
ecf9559d | 100 | \constfunc{wxString}{GetDocumentsDir}{\void} |
17af82fb VZ |
101 | |
102 | Return the directory containing the current user's documents. | |
103 | ||
104 | Example return values: | |
105 | \begin{itemize} | |
106 | \item Unix: \tt{~} (the home directory) | |
107 | \item Windows: \texttt{C:$\backslash$Documents and Settings$\backslash$\textit{username}$\backslash$Documents} | |
108 | \item Mac: \texttt{~/Documents} | |
109 | \end{itemize} | |
110 | ||
a06ee288 MR |
111 | \newsince{2.7.0} |
112 | ||
17af82fb | 113 | |
ac7ad70d RR |
114 | \membersection{wxStandardPaths::GetExecutablePath}\label{wxstandardpathsgetexecutablepath} |
115 | ||
116 | \constfunc{wxString}{GetExecutablePath}{\void} | |
117 | ||
118 | Return the directory and the filename for the current executable. | |
119 | ||
120 | Example return values: | |
121 | \begin{itemize} | |
122 | \item Unix: \texttt{/usr/local/bin/exename} | |
123 | \item Windows: \texttt{C:$\backslash$Programs$\backslash$AppFolder$\backslash$exename.exe} | |
124 | \item Mac: \texttt{/Programs/exename} | |
125 | \end{itemize} | |
126 | ||
127 | ||
128 | ||
48713afd VZ |
129 | \membersection{wxStandardPaths::GetInstallPrefix}\label{wxstandardpathsgetinstallprefix} |
130 | ||
ecf9559d | 131 | \constfunc{wxString}{GetInstallPrefix}{\void} |
48713afd VZ |
132 | |
133 | \textbf{Note: } This function is only available under Unix. | |
134 | ||
6cd6ec63 | 135 | Return the program installation prefix, e.g. \texttt{/usr}, \texttt{/opt} or |
48713afd | 136 | \texttt{/home/zeitlin}. |
1ee445c7 | 137 | |
6cd6ec63 | 138 | If the prefix had been previously by |
48713afd VZ |
139 | \helpref{SetInstallPrefix}{wxstandardpathssetinstallprefix}, returns that |
140 | value, otherwise tries to determine it automatically (Linux only right | |
141 | now) and finally returns the default \texttt{/usr/local} value if it failed. | |
1ee445c7 | 142 | |
48713afd VZ |
143 | |
144 | \membersection{wxStandardPaths::GetLocalDataDir}\label{wxstandardpathsgetlocaldatadir} | |
1ee445c7 | 145 | |
ecf9559d | 146 | \constfunc{wxString}{GetLocalDataDir}{\void} |
1ee445c7 VZ |
147 | |
148 | Return the location for application data files which are host-specific and | |
149 | can't, or shouldn't, be shared with the other machines. | |
150 | ||
48713afd | 151 | This is the same as \helpref{GetDataDir()}{wxstandardpathsgetdatadir} except |
1ee445c7 VZ |
152 | under Unix where it returns \texttt{/etc/\textit{appname}}. |
153 | ||
154 | ||
f3b0f8ad VZ |
155 | \membersection{wxStandardPaths::GetLocalizedResourcesDir}\label{wxstandardpathsgetlocalizedresourcesdir} |
156 | ||
e0b3b9d0 | 157 | \constfunc{wxString}{GetLocalizedResourcesDir}{\param{const wxString\&}{ lang}, \param{ResourceCat}{ category = ResourceCat\_None}} |
f3b0f8ad VZ |
158 | |
159 | Return the localized resources directory containing the resource files of the | |
160 | specified category for the given language. | |
161 | ||
6cd6ec63 WS |
162 | In general this is just the same as \arg{lang} subdirectory of |
163 | \helpref{GetResourcesDir()}{wxstandardpathsgetresourcesdir} (or | |
f3b0f8ad | 164 | \texttt{\arg{lang}.lproj} under Mac OS X) but is something quite |
6cd6ec63 | 165 | different for message catalog category under Unix where it returns the standard |
f3b0f8ad VZ |
166 | \texttt{\textit{prefix}/share/locale/\arg{lang}/LC\_MESSAGES} directory. |
167 | ||
a06ee288 MR |
168 | \newsince{2.7.0} |
169 | ||
f3b0f8ad | 170 | |
48713afd | 171 | \membersection{wxStandardPaths::GetPluginsDir}\label{wxstandardpathsgetpluginsdir} |
1ee445c7 | 172 | |
ecf9559d | 173 | \constfunc{wxString}{GetPluginsDir}{\void} |
1ee445c7 VZ |
174 | |
175 | Return the directory where the loadable modules (plugins) live. | |
176 | ||
f3b0f8ad VZ |
177 | Example return values: |
178 | \begin{itemize} | |
afc2d3bc MR |
179 | \item Unix: \texttt{\textit{prefix}/lib/\textit{appname}} |
180 | \item Windows: the directory of the executable file | |
181 | \item Mac: \texttt{\textit{appname}.app/Contents/PlugIns} bundle subdirectory | |
f3b0f8ad VZ |
182 | \end{itemize} |
183 | ||
184 | \wxheading{See also} | |
185 | ||
186 | \helpref{wxDynamicLibrary}{wxdynamiclibrary} | |
187 | ||
188 | ||
189 | \membersection{wxStandardPaths::GetResourcesDir}\label{wxstandardpathsgetresourcesdir} | |
190 | ||
ecf9559d | 191 | \constfunc{wxString}{GetResourcesDir}{\void} |
f3b0f8ad VZ |
192 | |
193 | Return the directory where the application resource files are located. The | |
194 | resources are the auxiliary data files needed for the application to run and | |
195 | include, for example, image and sound files it might use. | |
196 | ||
197 | This function is the same as \helpref{GetDataDir}{wxstandardpathsgetdatadir} for | |
198 | all platforms except Mac OS X. | |
199 | ||
1ee445c7 VZ |
200 | Example return values: |
201 | \begin{itemize} | |
afc2d3bc MR |
202 | \item Unix: \texttt{\textit{prefix}/share/\textit{appname}} |
203 | \item Windows: the directory where the executable file is located | |
204 | \item Mac: \texttt{\textit{appname}.app/Contents/Resources} bundle subdirectory | |
1ee445c7 VZ |
205 | \end{itemize} |
206 | ||
a06ee288 MR |
207 | \newsince{2.7.0} |
208 | ||
209 | ||
1ee445c7 VZ |
210 | \wxheading{See also} |
211 | ||
f3b0f8ad | 212 | \helpref{GetLocalizedResourcesDir}{wxstandardpathsgetlocalizedresourcesdir} |
1ee445c7 | 213 | |
ecf9559d JS |
214 | \membersection{wxStandardPaths::GetTempDir}\label{wxstandardpathsgettempdir} |
215 | ||
216 | \constfunc{wxString}{GetTempDir}{\void} | |
217 | ||
218 | Return the directory for storing temporary files. To create unique temporary files, | |
219 | it is best to use \helpref{wxFileName::CreateTempFileName}{wxfilenamecreatetempfilename} for correct behaviour when | |
220 | multiple processes are attempting to create temporary files. | |
221 | ||
222 | \newsince{2.7.2} | |
1ee445c7 | 223 | |
48713afd | 224 | \membersection{wxStandardPaths::GetUserConfigDir}\label{wxstandardpathsgetuserconfigdir} |
1ee445c7 | 225 | |
ecf9559d | 226 | \constfunc{wxString}{GetUserConfigDir}{\void} |
1ee445c7 VZ |
227 | |
228 | Return the directory for the user config files: | |
229 | \begin{itemize} | |
0d2b62c5 | 230 | \item Unix: \tt{~} (the home directory) |
da557e09 | 231 | \item Windows: \tt{C:$\backslash$Documents and Settings$\backslash$\textit{username}$\backslash$Application Data} |
0d2b62c5 | 232 | \item Mac: \tt{~/Library/Preferences} |
1ee445c7 VZ |
233 | \end{itemize} |
234 | ||
235 | Only use this method if you have a single configuration file to put in this | |
48713afd | 236 | directory, otherwise \helpref{GetUserDataDir()}{wxstandardpathsgetuserdatadir} is |
1ee445c7 VZ |
237 | more appropriate. |
238 | ||
239 | ||
48713afd | 240 | \membersection{wxStandardPaths::GetUserDataDir}\label{wxstandardpathsgetuserdatadir} |
1ee445c7 | 241 | |
ecf9559d | 242 | \constfunc{wxString}{GetUserDataDir}{\void} |
1ee445c7 VZ |
243 | |
244 | Return the directory for the user-dependent application data files: | |
245 | \begin{itemize} | |
0d2b62c5 | 246 | \item Unix: \tt{~/.\textit{appname}} |
6fdd4565 | 247 | \item Windows: \tt{C:$\backslash$Documents and Settings$\backslash$\textit{username}$\backslash$Application Data$\backslash$\textit{appname}} |
0d2b62c5 | 248 | \item Mac: \tt{~/Library/Application Support/\textit{appname}} |
1ee445c7 VZ |
249 | \end{itemize} |
250 | ||
251 | ||
48713afd | 252 | \membersection{wxStandardPaths::GetUserLocalDataDir}\label{wxstandardpathsgetuserlocaldatadir} |
1ee445c7 | 253 | |
ecf9559d | 254 | \constfunc{wxString}{GetUserLocalDataDir}{\void} |
1ee445c7 VZ |
255 | |
256 | Return the directory for user data files which shouldn't be shared with | |
257 | the other machines. | |
258 | ||
48713afd | 259 | This is the same as \helpref{GetUserDataDir()}{wxstandardpathsgetuserdatadir} for |
6cd6ec63 | 260 | all platforms except Windows where it returns |
96e2aec5 | 261 | \texttt{C:$\backslash$Documents and Settings$\backslash$\textit{username}$\backslash$Local Settings$\backslash$Application Data$\backslash$\textit{appname}} |
1ee445c7 VZ |
262 | |
263 | ||
48713afd VZ |
264 | \membersection{wxStandardPaths::SetInstallPrefix}\label{wxstandardpathssetinstallprefix} |
265 | ||
effdccd8 | 266 | \func{void}{SetInstallPrefix}{\param{const wxString\& }{prefix}} |
48713afd | 267 | |
dceb1c09 | 268 | \textbf{Note:} This function is only available under Unix. |
48713afd VZ |
269 | |
270 | Lets wxStandardPaths know about the real program installation prefix on a Unix | |
ac7ad70d | 271 | system. By default, the value returned by |
48713afd VZ |
272 | \helpref{GetInstallPrefix}{wxstandardpathsgetinstallprefix} is used. |
273 | ||
274 | Although under Linux systems the program prefix may usually be determined | |
275 | automatically, portable programs should call this function. Usually the prefix | |
276 | is set during program configuration if using GNU autotools and so it is enough | |
277 | to pass its value defined in \texttt{config.h} to this function. | |
278 |