]>
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 | */ | |
4cc4bfaf | 54 | static wxStandardPathsBase Get(); |
23324ae1 FM |
55 | |
56 | /** | |
57 | Return the directory containing the system config files. | |
23324ae1 | 58 | Example return values: |
4701dc09 FM |
59 | - Unix: @c /etc |
60 | - Windows: @c "C:\Documents and Settings\All Users\Application Data" | |
61 | - Mac: @c /Library/Preferences | |
3c4f71cc | 62 | |
4cc4bfaf | 63 | @see wxFileConfig |
23324ae1 | 64 | */ |
adaaa686 | 65 | virtual wxString GetConfigDir() const; |
23324ae1 FM |
66 | |
67 | /** | |
68 | Return the location of the applications global, i.e. not user-specific, | |
69 | data files. | |
23324ae1 | 70 | Example return values: |
4701dc09 FM |
71 | - Unix: @c prefix/share/appname |
72 | - Windows: the directory where the executable file is located | |
73 | - Mac: @c appname.app/Contents/SharedSupport bundle subdirectory | |
3c4f71cc | 74 | |
4cc4bfaf | 75 | @see GetLocalDataDir() |
23324ae1 | 76 | */ |
adaaa686 | 77 | virtual wxString GetDataDir() const; |
23324ae1 FM |
78 | |
79 | /** | |
80 | Return the directory containing the current user's documents. | |
23324ae1 | 81 | Example return values: |
4701dc09 FM |
82 | - Unix: @c ~ (the home directory) |
83 | - Windows: @c "C:\Documents and Settings\username\My Documents" | |
84 | - Mac: @c ~/Documents | |
3c4f71cc | 85 | |
1e24c2af | 86 | @since 2.7.0 |
23324ae1 | 87 | */ |
adaaa686 | 88 | virtual wxString GetDocumentsDir() const; |
23324ae1 FM |
89 | |
90 | /** | |
91 | Return the directory and the filename for the current executable. | |
23324ae1 | 92 | Example return values: |
4701dc09 FM |
93 | - Unix: @c /usr/local/bin/exename |
94 | - Windows: @c "C:\Programs\AppFolder\exename.exe" | |
95 | - Mac: @c /Programs/exename | |
23324ae1 | 96 | */ |
adaaa686 | 97 | virtual wxString GetExecutablePath() const; |
23324ae1 FM |
98 | |
99 | /** | |
4701dc09 FM |
100 | Return the program installation prefix, e.g. @c /usr, @c /opt or @c /home/zeitlin. |
101 | ||
89666a22 | 102 | If the prefix had been previously by SetInstallPrefix(), returns that |
4701dc09 FM |
103 | value, otherwise tries to determine it automatically (Linux only right now) |
104 | and finally returns the default @c /usr/local value if it failed. | |
105 | ||
106 | @note This function is only available under Unix. | |
23324ae1 | 107 | */ |
328f5751 | 108 | wxString GetInstallPrefix() const; |
23324ae1 FM |
109 | |
110 | /** | |
111 | Return the location for application data files which are host-specific and | |
112 | can't, or shouldn't, be shared with the other machines. | |
4701dc09 FM |
113 | |
114 | This is the same as GetDataDir() except under Unix where it returns @c /etc/appname. | |
23324ae1 | 115 | */ |
adaaa686 | 116 | virtual wxString GetLocalDataDir() const; |
23324ae1 FM |
117 | |
118 | /** | |
119 | Return the localized resources directory containing the resource files of the | |
120 | specified category for the given language. | |
4701dc09 FM |
121 | |
122 | In general this is just the same as @a lang subdirectory of GetResourcesDir() | |
123 | (or @c lang.lproj under Mac OS X) but is something quite different for | |
124 | message catalog category under Unix where it returns the standard | |
e3d8295c | 125 | @c prefix/share/locale/lang/LC_MESSAGES directory. |
3c4f71cc | 126 | |
1e24c2af | 127 | @since 2.7.0 |
23324ae1 | 128 | */ |
43c48e1e FM |
129 | virtual wxString GetLocalizedResourcesDir(const wxString& lang, |
130 | ResourceCat category) const; | |
23324ae1 FM |
131 | |
132 | /** | |
133 | Return the directory where the loadable modules (plugins) live. | |
23324ae1 | 134 | Example return values: |
4701dc09 FM |
135 | - Unix: @c prefix/lib/appname |
136 | - Windows: the directory of the executable file | |
137 | - Mac: @c appname.app/Contents/PlugIns bundle subdirectory | |
3c4f71cc | 138 | |
4cc4bfaf | 139 | @see wxDynamicLibrary |
23324ae1 | 140 | */ |
adaaa686 | 141 | virtual wxString GetPluginsDir() const; |
23324ae1 FM |
142 | |
143 | /** | |
4701dc09 FM |
144 | Return the directory where the application resource files are located. |
145 | ||
146 | The resources are the auxiliary data files needed for the application to run | |
147 | and include, for example, image and sound files it might use. | |
148 | ||
149 | This function is the same as GetDataDir() for all platforms except Mac OS X. | |
23324ae1 | 150 | Example return values: |
4701dc09 FM |
151 | - Unix: @c prefix/share/appname |
152 | - Windows: the directory where the executable file is located | |
153 | - Mac: @c appname.app/Contents/Resources bundle subdirectory | |
3c4f71cc | 154 | |
1e24c2af | 155 | @since 2.7.0 |
3c4f71cc | 156 | |
4cc4bfaf | 157 | @see GetLocalizedResourcesDir() |
23324ae1 | 158 | */ |
adaaa686 | 159 | virtual wxString GetResourcesDir() const; |
23324ae1 FM |
160 | |
161 | /** | |
4701dc09 FM |
162 | Return the directory for storing temporary files. |
163 | To create unique temporary files, it is best to use wxFileName::CreateTempFileName | |
164 | for correct behaviour when multiple processes are attempting to create temporary files. | |
3c4f71cc | 165 | |
1e24c2af | 166 | @since 2.7.2 |
23324ae1 | 167 | */ |
adaaa686 | 168 | virtual wxString GetTempDir() const; |
23324ae1 FM |
169 | |
170 | /** | |
171 | Return the directory for the user config files: | |
4701dc09 FM |
172 | - Unix: @c ~ (the home directory) |
173 | - Windows: @c "C:\Documents and Settings\username\Application Data" | |
174 | - Mac: @c ~/Library/Preferences | |
175 | ||
23324ae1 | 176 | Only use this method if you have a single configuration file to put in this |
4701dc09 | 177 | directory, otherwise GetUserDataDir() is more appropriate. |
23324ae1 | 178 | */ |
adaaa686 | 179 | virtual wxString GetUserConfigDir() const; |
23324ae1 FM |
180 | |
181 | /** | |
182 | Return the directory for the user-dependent application data files: | |
4701dc09 FM |
183 | - Unix: @c ~/.appname |
184 | - Windows: @c "C:\Documents and Settings\username\Application Data\appname" | |
185 | - Mac: @c "~/Library/Application Support/appname" | |
23324ae1 | 186 | */ |
adaaa686 | 187 | virtual wxString GetUserDataDir() const; |
23324ae1 FM |
188 | |
189 | /** | |
190 | Return the directory for user data files which shouldn't be shared with | |
191 | the other machines. | |
4701dc09 | 192 | |
ad51d1c8 | 193 | This is the same as GetUserDataDir() for all platforms except Windows where it returns |
4701dc09 | 194 | @c "C:\Documents and Settings\username\Local Settings\Application Data\appname" |
23324ae1 | 195 | */ |
adaaa686 | 196 | virtual wxString GetUserLocalDataDir() const; |
23324ae1 FM |
197 | |
198 | /** | |
23324ae1 | 199 | Lets wxStandardPaths know about the real program installation prefix on a Unix |
4701dc09 FM |
200 | system. By default, the value returned by GetInstallPrefix() is used. |
201 | ||
23324ae1 FM |
202 | Although under Linux systems the program prefix may usually be determined |
203 | automatically, portable programs should call this function. Usually the prefix | |
204 | is set during program configuration if using GNU autotools and so it is enough | |
205 | to pass its value defined in @c config.h to this function. | |
4701dc09 FM |
206 | |
207 | @note This function is only available under Unix. | |
23324ae1 FM |
208 | */ |
209 | void SetInstallPrefix(const wxString& prefix); | |
210 | ||
211 | /** | |
212 | Controls what application information is used when constructing paths that | |
213 | should be unique to this program, such as the application data directory, the | |
214 | plugins directory on Unix, etc. | |
4701dc09 FM |
215 | |
216 | Valid values for @a info are @c AppInfo_None and either one or combination | |
217 | of @c AppInfo_AppName and @c AppInfo_VendorName. The first one tells this | |
218 | class to not use neither application nor vendor name in the paths. | |
219 | ||
23324ae1 FM |
220 | By default, only the application name is used under Unix systems but both |
221 | application and vendor names are used under Windows and Mac. | |
222 | */ | |
223 | void UseAppInfo(int info); | |
224 | }; | |
e54c96f1 | 225 |