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