]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/stdpaths.h
more doc fixes, to wording and to return types ('&'s have been lost)
[wxWidgets.git] / interface / wx / stdpaths.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: stdpaths.h
3 // Purpose: interface of wxStandardPaths
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxStandardPaths
11
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.
14
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.
19 the Windows directory may be named @c "W:\Win2003" instead of
20 the default @c "C:\Windows".
21
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
25 default but may be changed using wxStandardPaths::SetInstallPrefix.
26
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
29 do it.
30
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.
35
36 This class is MT-safe: its methods may be called concurrently from different
37 threads without additional locking.
38
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
41 desired methods.
42
43 @library{wxbase}
44 @category{file}
45
46 @see wxFileConfig
47 */
48 class wxStandardPaths
49 {
50 public:
51 /**
52 Returns reference to the unique global standard paths object.
53 */
54 static wxStandardPathsBase Get();
55
56 /**
57 Return the directory containing the system config files.
58 Example return values:
59 - Unix: @c /etc
60 - Windows: @c "C:\Documents and Settings\All Users\Application Data"
61 - Mac: @c /Library/Preferences
62
63 @see wxFileConfig
64 */
65 virtual wxString GetConfigDir() const;
66
67 /**
68 Return the location of the applications global, i.e. not user-specific,
69 data files.
70 Example return values:
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
74
75 @see GetLocalDataDir()
76 */
77 virtual wxString GetDataDir() const;
78
79 /**
80 Return the directory containing the current user's documents.
81 Example return values:
82 - Unix: @c ~ (the home directory)
83 - Windows: @c "C:\Documents and Settings\username\My Documents"
84 - Mac: @c ~/Documents
85
86 @since 2.7.0
87 */
88 virtual wxString GetDocumentsDir() const;
89
90 /**
91 Return the directory and the filename for the current executable.
92 Example return values:
93 - Unix: @c /usr/local/bin/exename
94 - Windows: @c "C:\Programs\AppFolder\exename.exe"
95 - Mac: @c /Programs/exename
96 */
97 virtual wxString GetExecutablePath() const;
98
99 /**
100 Return the program installation prefix, e.g. @c /usr, @c /opt or @c /home/zeitlin.
101
102 If the prefix had been previously by SetInstallPrefix(), returns that
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.
107 */
108 wxString GetInstallPrefix() const;
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.
113
114 This is the same as GetDataDir() except under Unix where it returns @c /etc/appname.
115 */
116 virtual wxString GetLocalDataDir() const;
117
118 /**
119 Return the localized resources directory containing the resource files of the
120 specified category for the given language.
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
125 @c prefix/share/locale/lang/LC_MESSAGES directory.
126
127 @since 2.7.0
128 */
129 virtual wxString GetLocalizedResourcesDir(const wxString& lang,
130 ResourceCat category) const;
131
132 /**
133 Return the directory where the loadable modules (plugins) live.
134 Example return values:
135 - Unix: @c prefix/lib/appname
136 - Windows: the directory of the executable file
137 - Mac: @c appname.app/Contents/PlugIns bundle subdirectory
138
139 @see wxDynamicLibrary
140 */
141 virtual wxString GetPluginsDir() const;
142
143 /**
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.
150 Example return values:
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
154
155 @since 2.7.0
156
157 @see GetLocalizedResourcesDir()
158 */
159 virtual wxString GetResourcesDir() const;
160
161 /**
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.
165
166 @since 2.7.2
167 */
168 virtual wxString GetTempDir() const;
169
170 /**
171 Return the directory for the user config files:
172 - Unix: @c ~ (the home directory)
173 - Windows: @c "C:\Documents and Settings\username\Application Data"
174 - Mac: @c ~/Library/Preferences
175
176 Only use this method if you have a single configuration file to put in this
177 directory, otherwise GetUserDataDir() is more appropriate.
178 */
179 virtual wxString GetUserConfigDir() const;
180
181 /**
182 Return the directory for the user-dependent application data files:
183 - Unix: @c ~/.appname
184 - Windows: @c "C:\Documents and Settings\username\Application Data\appname"
185 - Mac: @c "~/Library/Application Support/appname"
186 */
187 virtual wxString GetUserDataDir() const;
188
189 /**
190 Return the directory for user data files which shouldn't be shared with
191 the other machines.
192
193 This is the same as GetUserDataDir() for all platforms except Windows where it returns
194 @c "C:\Documents and Settings\username\Local Settings\Application Data\appname"
195 */
196 virtual wxString GetUserLocalDataDir() const;
197
198 /**
199 Lets wxStandardPaths know about the real program installation prefix on a Unix
200 system. By default, the value returned by GetInstallPrefix() is used.
201
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.
206
207 @note This function is only available under Unix.
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.
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
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 };
225