]> git.saurik.com Git - wxWidgets.git/blame - interface/stdpaths.h
More initial reviews of [u*-v*] interface headers.
[wxWidgets.git] / interface / stdpaths.h
CommitLineData
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
11 @wxheader{stdpaths.h}
7c913512 12
23324ae1
FM
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.
7c913512 15
23324ae1
FM
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.
e3d8295c
RR
20 the Windows directory may be named @c W:\\Win2003 instead of
21 the default @c C:\\Windows.
7c913512 22
e3d8295c 23 The strings @c appname and @c username should be
23324ae1
FM
24 replaced with the value returned by wxApp::GetAppName
25 and the name of the currently logged in user, respectively. The string
e3d8295c 26 @c prefix is only used under Unix and is @c /usr/local by
23324ae1 27 default but may be changed using wxStandardPaths::SetInstallPrefix.
7c913512 28
23324ae1
FM
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
31 do it.
7c913512 32
23324ae1
FM
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.
7c913512 37
23324ae1
FM
38 This class is MT-safe: its methods may be called concurrently from different
39 threads without additional locking.
7c913512 40
23324ae1
FM
41 @library{wxbase}
42 @category{file}
7c913512 43
e54c96f1 44 @see wxFileConfig
89666a22 45 */
7c913512 46class wxStandardPaths
23324ae1
FM
47{
48public:
49 /**
50 Returns reference to the unique global standard paths object.
51 */
4cc4bfaf 52 static wxStandardPathsBase Get();
23324ae1
FM
53
54 /**
55 Return the directory containing the system config files.
23324ae1 56 Example return values:
ad51d1c8 57 - Unix: @c /etc
e3d8295c 58 - Windows: @c C:\\Documents @c and @c Settings\\All @c Users\\Application Data
ad51d1c8 59 - Mac: @c /Library/Preferences
3c4f71cc 60
4cc4bfaf 61 @see wxFileConfig
23324ae1 62 */
328f5751 63 wxString GetConfigDir() const;
23324ae1
FM
64
65 /**
66 Return the location of the applications global, i.e. not user-specific,
67 data files.
23324ae1 68 Example return values:
e3d8295c 69 - Unix: @c prefix/share/appname
ad51d1c8 70 - Windows: the directory where the executable file is located
e3d8295c 71 - Mac: @c appname.app/Contents/SharedSupport bundle subdirectory
3c4f71cc 72
4cc4bfaf 73 @see GetLocalDataDir()
23324ae1 74 */
328f5751 75 wxString GetDataDir() const;
23324ae1
FM
76
77 /**
78 Return the directory containing the current user's documents.
23324ae1 79 Example return values:
ad51d1c8 80 - Unix: @c ~ (the home directory)
e3d8295c 81 - Windows: @c C:\\Documents @c and @c Settings\\username\\Documents
ad51d1c8 82 - Mac: @c ~/Documents
3c4f71cc 83
1e24c2af 84 @since 2.7.0
23324ae1 85 */
328f5751 86 wxString GetDocumentsDir() const;
23324ae1
FM
87
88 /**
89 Return the directory and the filename for the current executable.
23324ae1 90 Example return values:
e3d8295c
RR
91 - Unix: @c /usr/local/bin/exename
92 - Windows: @c C:\\Programs\\AppFolder\\exename.exe
93 - Mac: @c /Programs/exename
23324ae1 94 */
328f5751 95 wxString GetExecutablePath() const;
23324ae1
FM
96
97 /**
cdbcf4c2 98 @note This function is only available under Unix.
23324ae1
FM
99 Return the program installation prefix, e.g. @c /usr, @c /opt or
100 @c /home/zeitlin.
89666a22 101 If the prefix had been previously by SetInstallPrefix(), returns that
23324ae1
FM
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.
104 */
328f5751 105 wxString GetInstallPrefix() const;
23324ae1
FM
106
107 /**
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.
23324ae1 110 This is the same as GetDataDir() except
e3d8295c 111 under Unix where it returns @c /etc/appname.
23324ae1 112 */
328f5751 113 wxString GetLocalDataDir() const;
23324ae1
FM
114
115 /**
116 Return the localized resources directory containing the resource files of the
117 specified category for the given language.
4cc4bfaf 118 In general this is just the same as @a lang subdirectory of
e3d8295c 119 GetResourcesDir() (or @c lang.lproj under Mac OS X) but is something quite
23324ae1 120 different for message catalog category under Unix where it returns the standard
e3d8295c 121 @c prefix/share/locale/lang/LC_MESSAGES directory.
3c4f71cc 122
1e24c2af 123 @since 2.7.0
23324ae1
FM
124 */
125 wxString GetLocalizedResourcesDir(const wxString& lang,
328f5751 126 ResourceCat category = ResourceCat_None) const;
23324ae1
FM
127
128 /**
129 Return the directory where the loadable modules (plugins) live.
23324ae1 130 Example return values:
e3d8295c 131 - Unix: @c prefix/lib/appname
ad51d1c8 132 - Windows: the directory of the executable file
e3d8295c 133 - Mac: @c appname.app/Contents/PlugIns bundle subdirectory
3c4f71cc 134
4cc4bfaf 135 @see wxDynamicLibrary
23324ae1 136 */
328f5751 137 wxString GetPluginsDir() const;
23324ae1
FM
138
139 /**
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.
23324ae1
FM
143 This function is the same as GetDataDir() for
144 all platforms except Mac OS X.
23324ae1 145 Example return values:
e3d8295c 146 - Unix: @c prefix/share/@e appname
ad51d1c8 147 - Windows: the directory where the executable file is located
e3d8295c 148 - Mac: @c appname.app/Contents/Resources bundle subdirectory
3c4f71cc 149
1e24c2af 150 @since 2.7.0
3c4f71cc 151
4cc4bfaf 152 @see GetLocalizedResourcesDir()
23324ae1 153 */
328f5751 154 wxString GetResourcesDir() const;
23324ae1
FM
155
156 /**
157 Return the directory for storing temporary files. To create unique temporary
158 files,
159 it is best to use wxFileName::CreateTempFileName for correct behaviour when
160 multiple processes are attempting to create temporary files.
3c4f71cc 161
1e24c2af 162 @since 2.7.2
23324ae1 163 */
328f5751 164 wxString GetTempDir() const;
23324ae1
FM
165
166 /**
167 Return the directory for the user config files:
ad51d1c8 168 - Unix: @c ~ (the home directory)
e3d8295c 169 - Windows: @c C:\\Documents @c and @c Settings\\username\\Application Data
ad51d1c8 170 - Mac: @c ~/Library/Preferences
23324ae1
FM
171 Only use this method if you have a single configuration file to put in this
172 directory, otherwise GetUserDataDir() is
173 more appropriate.
174 */
328f5751 175 wxString GetUserConfigDir() const;
23324ae1
FM
176
177 /**
178 Return the directory for the user-dependent application data files:
e3d8295c
RR
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
23324ae1 182 */
328f5751 183 wxString GetUserDataDir() const;
23324ae1
FM
184
185 /**
186 Return the directory for user data files which shouldn't be shared with
187 the other machines.
ad51d1c8 188 This is the same as GetUserDataDir() for all platforms except Windows where it returns
e3d8295c 189 @c C:\\Documents @c and @c Settings\\username\\Local @c Settings\\Application @c Data\appname
23324ae1 190 */
328f5751 191 wxString GetUserLocalDataDir() const;
23324ae1
FM
192
193 /**
cdbcf4c2 194 @note This function is only available under Unix.
23324ae1
FM
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.
23324ae1
FM
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.
202 */
203 void SetInstallPrefix(const wxString& prefix);
204
205 /**
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.
4cc4bfaf 209 Valid values for @a info are @c AppInfo_None and either one or
23324ae1
FM
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
212 the paths.
23324ae1
FM
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.
215 */
216 void UseAppInfo(int info);
217};
e54c96f1 218