]>
git.saurik.com Git - wxWidgets.git/blob - interface/stdpaths.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxStandardPaths
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxStandardPaths
13 wxStandardPaths returns the standard locations in the file system and should be
14 used by applications to find their data files in a portable way.
16 In the description of the methods below, the example return values are given
17 for the Unix, Windows and Mac OS X systems, however please note that these are
18 just the examples and the actual values may differ. For example, under Windows:
19 the system administrator may change the standard directories locations, i.e.
20 the Windows directory may be named @c W:\\Win2003 instead of
21 the default @c C:\\Windows.
23 The strings @c appname and @c username should be
24 replaced with the value returned by wxApp::GetAppName
25 and the name of the currently logged in user, respectively. The string
26 @c prefix is only used under Unix and is @c /usr/local by
27 default but may be changed using wxStandardPaths::SetInstallPrefix.
29 The directories returned by the methods of this class may or may not exist. If
30 they don't exist, it's up to the caller to create them, wxStandardPaths doesn't
33 Finally note that these functions only work with standardly packaged
34 applications. I.e. under Unix you should follow the standard installation
35 conventions and under Mac you should create your application bundle according
36 to the Apple guidelines. Again, this class doesn't help you to do it.
38 This class is MT-safe: its methods may be called concurrently from different
39 threads without additional locking.
50 Returns reference to the unique global standard paths object.
52 static wxStandardPathsBase
Get();
55 Return the directory containing the system config files.
56 Example return values:
58 - Windows: @c C:\\Documents @c and @c Settings\\All @c Users\\Application Data
59 - Mac: @c /Library/Preferences
63 wxString
GetConfigDir() const;
66 Return the location of the applications global, i.e. not user-specific,
68 Example return values:
69 - Unix: @c prefix/share/appname
70 - Windows: the directory where the executable file is located
71 - Mac: @c appname.app/Contents/SharedSupport bundle subdirectory
73 @see GetLocalDataDir()
75 wxString
GetDataDir() const;
78 Return the directory containing the current user's documents.
79 Example return values:
80 - Unix: @c ~ (the home directory)
81 - Windows: @c C:\\Documents @c and @c Settings\\username\\Documents
86 wxString
GetDocumentsDir() const;
89 Return the directory and the filename for the current executable.
90 Example return values:
91 - Unix: @c /usr/local/bin/exename
92 - Windows: @c C:\\Programs\\AppFolder\\exename.exe
93 - Mac: @c /Programs/exename
95 wxString
GetExecutablePath() const;
98 @note This function is only available under Unix.
99 Return the program installation prefix, e.g. @c /usr, @c /opt or
101 If the prefix had been previously by SetInstallPrefix(), returns that
102 value, otherwise tries to determine it automatically (Linux only right
103 now) and finally returns the default @c /usr/local value if it failed.
105 wxString
GetInstallPrefix() const;
108 Return the location for application data files which are host-specific and
109 can't, or shouldn't, be shared with the other machines.
110 This is the same as GetDataDir() except
111 under Unix where it returns @c /etc/appname.
113 wxString
GetLocalDataDir() const;
116 Return the localized resources directory containing the resource files of the
117 specified category for the given language.
118 In general this is just the same as @a lang subdirectory of
119 GetResourcesDir() (or @c lang.lproj under Mac OS X) but is something quite
120 different for message catalog category under Unix where it returns the standard
121 @c prefix/share/locale/lang/LC_MESSAGES directory.
125 wxString
GetLocalizedResourcesDir(const wxString
& lang
,
126 ResourceCat category
= ResourceCat_None
) const;
129 Return the directory where the loadable modules (plugins) live.
130 Example return values:
131 - Unix: @c prefix/lib/appname
132 - Windows: the directory of the executable file
133 - Mac: @c appname.app/Contents/PlugIns bundle subdirectory
135 @see wxDynamicLibrary
137 wxString
GetPluginsDir() const;
140 Return the directory where the application resource files are located. The
141 resources are the auxiliary data files needed for the application to run and
142 include, for example, image and sound files it might use.
143 This function is the same as GetDataDir() for
144 all platforms except Mac OS X.
145 Example return values:
146 - Unix: @c prefix/share/@e appname
147 - Windows: the directory where the executable file is located
148 - Mac: @c appname.app/Contents/Resources bundle subdirectory
152 @see GetLocalizedResourcesDir()
154 wxString
GetResourcesDir() const;
157 Return the directory for storing temporary files. To create unique temporary
159 it is best to use wxFileName::CreateTempFileName for correct behaviour when
160 multiple processes are attempting to create temporary files.
164 wxString
GetTempDir() const;
167 Return the directory for the user config files:
168 - Unix: @c ~ (the home directory)
169 - Windows: @c C:\\Documents @c and @c Settings\\username\\Application Data
170 - Mac: @c ~/Library/Preferences
171 Only use this method if you have a single configuration file to put in this
172 directory, otherwise GetUserDataDir() is
175 wxString
GetUserConfigDir() const;
178 Return the directory for the user-dependent application data files:
179 - Unix: @c ~/.appname
180 - Windows: @c C:\\Documents @c and @c Settings\\username\Application @c Data\appname
181 - Mac: @c ~/Library/Application @c Support/appname
183 wxString
GetUserDataDir() const;
186 Return the directory for user data files which shouldn't be shared with
188 This is the same as GetUserDataDir() for all platforms except Windows where it returns
189 @c C:\\Documents @c and @c Settings\\username\\Local @c Settings\\Application @c Data\appname
191 wxString
GetUserLocalDataDir() const;
194 @note This function is only available under Unix.
195 Lets wxStandardPaths know about the real program installation prefix on a Unix
196 system. By default, the value returned by
197 GetInstallPrefix() is used.
198 Although under Linux systems the program prefix may usually be determined
199 automatically, portable programs should call this function. Usually the prefix
200 is set during program configuration if using GNU autotools and so it is enough
201 to pass its value defined in @c config.h to this function.
203 void SetInstallPrefix(const wxString
& prefix
);
206 Controls what application information is used when constructing paths that
207 should be unique to this program, such as the application data directory, the
208 plugins directory on Unix, etc.
209 Valid values for @a info are @c AppInfo_None and either one or
210 combination of @c AppInfo_AppName and @c AppInfo_VendorName. The
211 first one tells this class to not use neither application nor vendor name in
213 By default, only the application name is used under Unix systems but both
214 application and vendor names are used under Windows and Mac.
216 void UseAppInfo(int info
);