1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: declaration of wxStandardPaths class
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_STDPATHS_H_
13 #define _WX_STDPATHS_H_
19 #include "wx/string.h"
20 #include "wx/filefn.h"
22 // ----------------------------------------------------------------------------
23 // wxStandardPaths returns the standard locations in the file system
24 // ----------------------------------------------------------------------------
26 class WXDLLIMPEXP_BASE wxStandardPathsBase
29 // possible resources categorires
32 // no special category
35 // message catalog resources
43 // return the global standard paths object
44 static wxStandardPathsBase
& Get();
47 // return the directory with system config files:
48 // /etc under Unix, c:\Documents and Settings\All Users\Application Data
49 // under Windows, /Library/Preferences for Mac
50 virtual wxString
GetConfigDir() const = 0;
52 // return the directory for the user config files:
53 // $HOME under Unix, c:\Documents and Settings\username under Windows,
54 // ~/Library/Preferences under Mac
56 // only use this if you have a single file to put there, otherwise
57 // GetUserDataDir() is more appropriate
58 virtual wxString
GetUserConfigDir() const = 0;
60 // return the location of the applications global, i.e. not user-specific,
63 // prefix/share/appname under Unix, c:\Program Files\appname under Windows,
64 // appname.app/Contents/SharedSupport app bundle directory under Mac
65 virtual wxString
GetDataDir() const = 0;
67 // return the location for application data files which are host-specific
69 // same as GetDataDir() except under Unix where it is /etc/appname
70 virtual wxString
GetLocalDataDir() const;
72 // return the directory for the user-dependent application data files
74 // $HOME/.appname under Unix,
75 // c:\Documents and Settings\username\Application Data\appname under Windows
76 // and ~/Library/Application Support/appname under Mac
77 virtual wxString
GetUserDataDir() const = 0;
79 // return the directory for user data files which shouldn't be shared with
82 // same as GetUserDataDir() for all platforms except Windows where it is
83 // the "Local Settings\Application Data\appname" directory
84 virtual wxString
GetUserLocalDataDir() const;
86 // return the directory where the loadable modules (plugins) live
88 // prefix/lib/appname under Unix, program directory under Windows and
89 // Contents/Plugins app bundle subdirectory under Mac
90 virtual wxString
GetPluginsDir() const = 0;
92 // get resources directory: resources are auxiliary files used by the
93 // application and include things like image and sound files
95 // same as GetDataDir() for all platforms except Mac where it returns
96 // Contents/Resources subdirectory of the app bundle
97 virtual wxString
GetResourcesDir() const { return GetDataDir(); }
99 // get localized resources directory containing the resource files of the
100 // specified category for the given language
102 // in general this is just GetResourcesDir()/lang under Windows and Unix
103 // and GetResourcesDir()/lang.lproj under Mac but is something quite
104 // different under Unix for message catalog category (namely the standard
105 // prefix/share/locale/lang/LC_MESSAGES)
107 GetLocalizedResourcesDir(const wxChar
*lang
,
108 ResourceCat
WXUNUSED(category
)
109 = ResourceCat_None
) const
111 return GetResourcesDir() + wxFILE_SEP_PATH
+ lang
;
114 // return the "Documents" directory for the current user
116 // C:\Documents and Settings\username\Documents under Windows,
117 // $HOME under Unix and ~/Documents under Mac
118 virtual wxString
GetDocumentsDir() const;
120 // return the temporary directory for the current user
121 virtual wxString
GetTempDir() const;
124 // virtual dtor for the base class
125 virtual ~wxStandardPathsBase();
128 // append "/appname" suffix if the app name is set (doesn't append the
129 // slash if dir already ends with a slash or dot)
130 static wxString
AppendAppName(const wxString
& dir
);
133 #if defined(__WXMSW__)
134 #include "wx/msw/stdpaths.h"
135 // We want CoreFoundation paths on both CarbonLib and Darwin (for all ports)
136 #elif defined(__WXMAC__) || defined(__DARWIN__)
137 #include "wx/mac/corefoundation/stdpaths.h"
138 #elif defined(__OS2__)
139 #include "wx/os2/stdpaths.h"
140 #elif defined(__UNIX__)
141 #include "wx/unix/stdpaths.h"
142 #elif defined(__PALMOS__)
143 #include "wx/palmos/stdpaths.h"
146 // ----------------------------------------------------------------------------
147 // Minimal generic implementation
148 // ----------------------------------------------------------------------------
150 class WXDLLIMPEXP_BASE wxStandardPaths
: public wxStandardPathsBase
153 void SetInstallPrefix(const wxString
& prefix
) { m_prefix
= prefix
; }
154 wxString
GetInstallPrefix() const { return m_prefix
; }
155 virtual wxString
GetConfigDir() const { return m_prefix
; }
156 virtual wxString
GetUserConfigDir() const { return m_prefix
; }
157 virtual wxString
GetDataDir() const { return m_prefix
; }
158 virtual wxString
GetLocalDataDir() const { return m_prefix
; }
159 virtual wxString
GetUserDataDir() const { return m_prefix
; }
160 virtual wxString
GetPluginsDir() const { return m_prefix
; }
161 virtual wxString
GetDocumentsDir() const { return m_prefix
; }
169 #endif // wxUSE_STDPATHS
171 #endif // _WX_STDPATHS_H_