]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/stdpaths.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxStandardPaths
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxStandardPaths
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.
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.
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.
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
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.
37 This class is MT-safe: its methods may be called concurrently from different
38 threads without additional locking.
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
53 Returns reference to the unique global standard paths object.
55 static wxStandardPathsBase
Get();
58 Return the directory containing the system config files.
59 Example return values:
61 - Windows: @c C:\\Documents @c and @c Settings\\All @c Users\\Application Data
62 - Mac: @c /Library/Preferences
66 wxString
GetConfigDir() const;
69 Return the location of the applications global, i.e. not user-specific,
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
76 @see GetLocalDataDir()
78 wxString
GetDataDir() const;
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
89 wxString
GetDocumentsDir() const;
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
98 wxString
GetExecutablePath() const;
101 @note This function is only available under Unix.
102 Return the program installation prefix, e.g. @c /usr, @c /opt or
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.
108 wxString
GetInstallPrefix() const;
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.
116 wxString
GetLocalDataDir() const;
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.
128 wxString
GetLocalizedResourcesDir(const wxString
& lang
,
129 ResourceCat category
= ResourceCat_None
) const;
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
138 @see wxDynamicLibrary
140 wxString
GetPluginsDir() const;
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
155 @see GetLocalizedResourcesDir()
157 wxString
GetResourcesDir() const;
160 Return the directory for storing temporary files. To create unique temporary
162 it is best to use wxFileName::CreateTempFileName for correct behaviour when
163 multiple processes are attempting to create temporary files.
167 wxString
GetTempDir() const;
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
178 wxString
GetUserConfigDir() const;
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
186 wxString
GetUserDataDir() const;
189 Return the directory for user data files which shouldn't be shared with
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
194 wxString
GetUserLocalDataDir() const;
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.
206 void SetInstallPrefix(const wxString
& prefix
);
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
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.
219 void UseAppInfo(int info
);