]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/stdpaths.h
fix parsing of IP literals in URIs, added test for it
[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
23 replaced with the value returned by wxApp::GetAppName
24 and the name of the currently logged in user, respectively. The string
25 @c prefix is only used under Unix and is @c /usr/local by
26 default but may be changed using wxStandardPaths::SetInstallPrefix.
27
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.
31
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.
36
37 This class is MT-safe: its methods may be called concurrently from different
38 threads without additional locking.
39
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
44 @library{wxbase}
45 @category{file}
46
47 @see wxFileConfig
48 */
49 class wxStandardPaths
50 {
51 public:
52 /**
53 Returns reference to the unique global standard paths object.
54 */
55 static wxStandardPathsBase Get();
56
57 /**
58 Return the directory containing the system config files.
59 Example return values:
60 - Unix: @c /etc
61 - Windows: @c C:\\Documents @c and @c Settings\\All @c Users\\Application Data
62 - Mac: @c /Library/Preferences
63
64 @see wxFileConfig
65 */
66 wxString GetConfigDir() const;
67
68 /**
69 Return the location of the applications global, i.e. not user-specific,
70 data files.
71 Example return values:
72 - Unix: @c prefix/share/appname
73 - Windows: the directory where the executable file is located
74 - Mac: @c appname.app/Contents/SharedSupport bundle subdirectory
75
76 @see GetLocalDataDir()
77 */
78 wxString GetDataDir() const;
79
80 /**
81 Return the directory containing the current user's documents.
82 Example return values:
83 - Unix: @c ~ (the home directory)
84 - Windows: @c C:\\Documents @c and @c Settings\\username\\Documents
85 - Mac: @c ~/Documents
86
87 @since 2.7.0
88 */
89 wxString GetDocumentsDir() const;
90
91 /**
92 Return the directory and the filename for the current executable.
93 Example return values:
94 - Unix: @c /usr/local/bin/exename
95 - Windows: @c C:\\Programs\\AppFolder\\exename.exe
96 - Mac: @c /Programs/exename
97 */
98 wxString GetExecutablePath() const;
99
100 /**
101 @note This function is only available under Unix.
102 Return the program installation prefix, e.g. @c /usr, @c /opt or
103 @c /home/zeitlin.
104 If the prefix had been previously by SetInstallPrefix(), returns that
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 */
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 This is the same as GetDataDir() except
114 under Unix where it returns @c /etc/appname.
115 */
116 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 In general this is just the same as @a lang subdirectory of
122 GetResourcesDir() (or @c lang.lproj under Mac OS X) but is something quite
123 different for message catalog category under Unix where it returns the standard
124 @c prefix/share/locale/lang/LC_MESSAGES directory.
125
126 @since 2.7.0
127 */
128 wxString GetLocalizedResourcesDir(const wxString& lang,
129 ResourceCat category = ResourceCat_None) const;
130
131 /**
132 Return the directory where the loadable modules (plugins) live.
133 Example return values:
134 - Unix: @c prefix/lib/appname
135 - Windows: the directory of the executable file
136 - Mac: @c appname.app/Contents/PlugIns bundle subdirectory
137
138 @see wxDynamicLibrary
139 */
140 wxString GetPluginsDir() const;
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.
146 This function is the same as GetDataDir() for
147 all platforms except Mac OS X.
148 Example return values:
149 - Unix: @c prefix/share/@e appname
150 - Windows: the directory where the executable file is located
151 - Mac: @c appname.app/Contents/Resources bundle subdirectory
152
153 @since 2.7.0
154
155 @see GetLocalizedResourcesDir()
156 */
157 wxString GetResourcesDir() const;
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.
164
165 @since 2.7.2
166 */
167 wxString GetTempDir() const;
168
169 /**
170 Return the directory for the user config files:
171 - Unix: @c ~ (the home directory)
172 - Windows: @c C:\\Documents @c and @c Settings\\username\\Application Data
173 - Mac: @c ~/Library/Preferences
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 */
178 wxString GetUserConfigDir() const;
179
180 /**
181 Return the directory for the user-dependent application data files:
182 - Unix: @c ~/.appname
183 - Windows: @c C:\\Documents @c and @c Settings\\username\\Application @c Data\\appname
184 - Mac: @c ~/Library/Application @c Support/appname
185 */
186 wxString GetUserDataDir() const;
187
188 /**
189 Return the directory for user data files which shouldn't be shared with
190 the other machines.
191 This is the same as GetUserDataDir() for all platforms except Windows where it returns
192 @c C:\\Documents @c and @c Settings\\username\\Local @c Settings\\Application @c Data\\appname
193 */
194 wxString GetUserLocalDataDir() const;
195
196 /**
197 @note This function is only available under Unix.
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.
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.
212 Valid values for @a info are @c AppInfo_None and either one or
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.
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 };
221