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