]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: stdpaths.h | |
e54c96f1 | 3 | // Purpose: interface of wxStandardPaths |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxStandardPaths | |
7c913512 | 11 | |
23324ae1 FM |
12 | wxStandardPaths returns the standard locations in the file system and should be |
13 | used by applications to find their data files in a portable way. | |
7c913512 | 14 | |
23324ae1 FM |
15 | In the description of the methods below, the example return values are given |
16 | for the Unix, Windows and Mac OS X systems, however please note that these are | |
17 | just the examples and the actual values may differ. For example, under Windows: | |
18 | the system administrator may change the standard directories locations, i.e. | |
4701dc09 FM |
19 | the Windows directory may be named @c "W:\Win2003" instead of |
20 | the default @c "C:\Windows". | |
7c913512 | 21 | |
4701dc09 FM |
22 | The strings @c appname and @c username should be replaced with the value |
23 | returned by wxApp::GetAppName() and the name of the currently logged in user, | |
24 | respectively. The string @c prefix is only used under Unix and is @c /usr/local by | |
23324ae1 | 25 | default but may be changed using wxStandardPaths::SetInstallPrefix. |
7c913512 | 26 | |
4701dc09 FM |
27 | The directories returned by the methods of this class may or may not exist. |
28 | If they don't exist, it's up to the caller to create them, wxStandardPaths doesn't | |
23324ae1 | 29 | do it. |
7c913512 | 30 | |
23324ae1 FM |
31 | Finally note that these functions only work with standardly packaged |
32 | applications. I.e. under Unix you should follow the standard installation | |
33 | conventions and under Mac you should create your application bundle according | |
34 | to the Apple guidelines. Again, this class doesn't help you to do it. | |
7c913512 | 35 | |
23324ae1 FM |
36 | This class is MT-safe: its methods may be called concurrently from different |
37 | threads without additional locking. | |
7c913512 | 38 | |
4701dc09 FM |
39 | Note that you don't allocate an instance of class wxStandardPaths, but retrieve the |
40 | global standard paths object using @c wxStandardPaths::Get on which you call the | |
0b1b2c71 SC |
41 | desired methods. |
42 | ||
23324ae1 FM |
43 | @library{wxbase} |
44 | @category{file} | |
7c913512 | 45 | |
e54c96f1 | 46 | @see wxFileConfig |
4701dc09 | 47 | */ |
7c913512 | 48 | class wxStandardPaths |
23324ae1 FM |
49 | { |
50 | public: | |
51 | /** | |
52 | Returns reference to the unique global standard paths object. | |
53 | */ | |
382f12e4 | 54 | static wxStandardPathsBase& Get(); |
23324ae1 | 55 | |
d8efd219 VZ |
56 | /** |
57 | Return the directory for the document files used by this application. | |
58 | ||
59 | If the application-specific directory doesn't exist, this function | |
60 | returns GetDocumentsDir(). | |
61 | ||
62 | Example return values: | |
63 | - Unix: @c ~/appname | |
64 | - Windows: @c "C:\Documents and Settings\username\My Documents\appname" | |
65 | - Mac: @c ~/Documents/appname | |
66 | ||
67 | @since 2.9.0 | |
68 | ||
69 | @see GetAppDocumentsDir() | |
70 | */ | |
71 | virtual wxString GetAppDocumentsDir() const; | |
72 | ||
23324ae1 FM |
73 | /** |
74 | Return the directory containing the system config files. | |
23324ae1 | 75 | Example return values: |
4701dc09 FM |
76 | - Unix: @c /etc |
77 | - Windows: @c "C:\Documents and Settings\All Users\Application Data" | |
78 | - Mac: @c /Library/Preferences | |
3c4f71cc | 79 | |
4cc4bfaf | 80 | @see wxFileConfig |
23324ae1 | 81 | */ |
adaaa686 | 82 | virtual wxString GetConfigDir() const; |
23324ae1 FM |
83 | |
84 | /** | |
85 | Return the location of the applications global, i.e. not user-specific, | |
86 | data files. | |
23324ae1 | 87 | Example return values: |
4701dc09 FM |
88 | - Unix: @c prefix/share/appname |
89 | - Windows: the directory where the executable file is located | |
90 | - Mac: @c appname.app/Contents/SharedSupport bundle subdirectory | |
3c4f71cc | 91 | |
4cc4bfaf | 92 | @see GetLocalDataDir() |
23324ae1 | 93 | */ |
adaaa686 | 94 | virtual wxString GetDataDir() const; |
23324ae1 FM |
95 | |
96 | /** | |
97 | Return the directory containing the current user's documents. | |
d8efd219 | 98 | |
23324ae1 | 99 | Example return values: |
4701dc09 FM |
100 | - Unix: @c ~ (the home directory) |
101 | - Windows: @c "C:\Documents and Settings\username\My Documents" | |
102 | - Mac: @c ~/Documents | |
3c4f71cc | 103 | |
1e24c2af | 104 | @since 2.7.0 |
d8efd219 VZ |
105 | |
106 | @see GetAppDocumentsDir() | |
23324ae1 | 107 | */ |
adaaa686 | 108 | virtual wxString GetDocumentsDir() const; |
23324ae1 FM |
109 | |
110 | /** | |
111 | Return the directory and the filename for the current executable. | |
23324ae1 | 112 | Example return values: |
4701dc09 FM |
113 | - Unix: @c /usr/local/bin/exename |
114 | - Windows: @c "C:\Programs\AppFolder\exename.exe" | |
115 | - Mac: @c /Programs/exename | |
23324ae1 | 116 | */ |
adaaa686 | 117 | virtual wxString GetExecutablePath() const; |
23324ae1 FM |
118 | |
119 | /** | |
4701dc09 FM |
120 | Return the program installation prefix, e.g. @c /usr, @c /opt or @c /home/zeitlin. |
121 | ||
89666a22 | 122 | If the prefix had been previously by SetInstallPrefix(), returns that |
4701dc09 FM |
123 | value, otherwise tries to determine it automatically (Linux only right now) |
124 | and finally returns the default @c /usr/local value if it failed. | |
125 | ||
126 | @note This function is only available under Unix. | |
23324ae1 | 127 | */ |
328f5751 | 128 | wxString GetInstallPrefix() const; |
23324ae1 FM |
129 | |
130 | /** | |
131 | Return the location for application data files which are host-specific and | |
132 | can't, or shouldn't, be shared with the other machines. | |
4701dc09 FM |
133 | |
134 | This is the same as GetDataDir() except under Unix where it returns @c /etc/appname. | |
23324ae1 | 135 | */ |
adaaa686 | 136 | virtual wxString GetLocalDataDir() const; |
23324ae1 FM |
137 | |
138 | /** | |
139 | Return the localized resources directory containing the resource files of the | |
140 | specified category for the given language. | |
4701dc09 FM |
141 | |
142 | In general this is just the same as @a lang subdirectory of GetResourcesDir() | |
143 | (or @c lang.lproj under Mac OS X) but is something quite different for | |
144 | message catalog category under Unix where it returns the standard | |
e3d8295c | 145 | @c prefix/share/locale/lang/LC_MESSAGES directory. |
3c4f71cc | 146 | |
1e24c2af | 147 | @since 2.7.0 |
23324ae1 | 148 | */ |
43c48e1e FM |
149 | virtual wxString GetLocalizedResourcesDir(const wxString& lang, |
150 | ResourceCat category) const; | |
23324ae1 FM |
151 | |
152 | /** | |
153 | Return the directory where the loadable modules (plugins) live. | |
23324ae1 | 154 | Example return values: |
4701dc09 FM |
155 | - Unix: @c prefix/lib/appname |
156 | - Windows: the directory of the executable file | |
157 | - Mac: @c appname.app/Contents/PlugIns bundle subdirectory | |
3c4f71cc | 158 | |
4cc4bfaf | 159 | @see wxDynamicLibrary |
23324ae1 | 160 | */ |
adaaa686 | 161 | virtual wxString GetPluginsDir() const; |
23324ae1 FM |
162 | |
163 | /** | |
4701dc09 FM |
164 | Return the directory where the application resource files are located. |
165 | ||
166 | The resources are the auxiliary data files needed for the application to run | |
167 | and include, for example, image and sound files it might use. | |
168 | ||
169 | This function is the same as GetDataDir() for all platforms except Mac OS X. | |
23324ae1 | 170 | Example return values: |
4701dc09 FM |
171 | - Unix: @c prefix/share/appname |
172 | - Windows: the directory where the executable file is located | |
173 | - Mac: @c appname.app/Contents/Resources bundle subdirectory | |
3c4f71cc | 174 | |
1e24c2af | 175 | @since 2.7.0 |
3c4f71cc | 176 | |
4cc4bfaf | 177 | @see GetLocalizedResourcesDir() |
23324ae1 | 178 | */ |
adaaa686 | 179 | virtual wxString GetResourcesDir() const; |
23324ae1 FM |
180 | |
181 | /** | |
4701dc09 FM |
182 | Return the directory for storing temporary files. |
183 | To create unique temporary files, it is best to use wxFileName::CreateTempFileName | |
184 | for correct behaviour when multiple processes are attempting to create temporary files. | |
3c4f71cc | 185 | |
1e24c2af | 186 | @since 2.7.2 |
23324ae1 | 187 | */ |
adaaa686 | 188 | virtual wxString GetTempDir() const; |
23324ae1 FM |
189 | |
190 | /** | |
191 | Return the directory for the user config files: | |
4701dc09 FM |
192 | - Unix: @c ~ (the home directory) |
193 | - Windows: @c "C:\Documents and Settings\username\Application Data" | |
194 | - Mac: @c ~/Library/Preferences | |
195 | ||
23324ae1 | 196 | Only use this method if you have a single configuration file to put in this |
4701dc09 | 197 | directory, otherwise GetUserDataDir() is more appropriate. |
23324ae1 | 198 | */ |
adaaa686 | 199 | virtual wxString GetUserConfigDir() const; |
23324ae1 FM |
200 | |
201 | /** | |
202 | Return the directory for the user-dependent application data files: | |
4701dc09 FM |
203 | - Unix: @c ~/.appname |
204 | - Windows: @c "C:\Documents and Settings\username\Application Data\appname" | |
205 | - Mac: @c "~/Library/Application Support/appname" | |
23324ae1 | 206 | */ |
adaaa686 | 207 | virtual wxString GetUserDataDir() const; |
23324ae1 FM |
208 | |
209 | /** | |
210 | Return the directory for user data files which shouldn't be shared with | |
211 | the other machines. | |
4701dc09 | 212 | |
ad51d1c8 | 213 | This is the same as GetUserDataDir() for all platforms except Windows where it returns |
4701dc09 | 214 | @c "C:\Documents and Settings\username\Local Settings\Application Data\appname" |
23324ae1 | 215 | */ |
adaaa686 | 216 | virtual wxString GetUserLocalDataDir() const; |
23324ae1 FM |
217 | |
218 | /** | |
23324ae1 | 219 | Lets wxStandardPaths know about the real program installation prefix on a Unix |
4701dc09 FM |
220 | system. By default, the value returned by GetInstallPrefix() is used. |
221 | ||
23324ae1 FM |
222 | Although under Linux systems the program prefix may usually be determined |
223 | automatically, portable programs should call this function. Usually the prefix | |
224 | is set during program configuration if using GNU autotools and so it is enough | |
225 | to pass its value defined in @c config.h to this function. | |
4701dc09 FM |
226 | |
227 | @note This function is only available under Unix. | |
23324ae1 FM |
228 | */ |
229 | void SetInstallPrefix(const wxString& prefix); | |
230 | ||
231 | /** | |
232 | Controls what application information is used when constructing paths that | |
233 | should be unique to this program, such as the application data directory, the | |
234 | plugins directory on Unix, etc. | |
4701dc09 FM |
235 | |
236 | Valid values for @a info are @c AppInfo_None and either one or combination | |
237 | of @c AppInfo_AppName and @c AppInfo_VendorName. The first one tells this | |
238 | class to not use neither application nor vendor name in the paths. | |
239 | ||
23324ae1 FM |
240 | By default, only the application name is used under Unix systems but both |
241 | application and vendor names are used under Windows and Mac. | |
242 | */ | |
243 | void UseAppInfo(int info); | |
244 | }; | |
e54c96f1 | 245 |