]>
Commit | Line | Data |
---|---|---|
1ee445c7 | 1 | /////////////////////////////////////////////////////////////////////////////// |
96e2aec5 VZ |
2 | // Name: wx/stdpaths.h |
3 | // Purpose: declaration of wxStandardPaths class | |
1ee445c7 VZ |
4 | // Author: Vadim Zeitlin |
5 | // Modified by: | |
6 | // Created: 2004-10-17 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org> | |
9 | // Licence: wxWindows licence | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
0b75a1e0 VZ |
12 | #ifndef _WX_STDPATHS_H_ |
13 | #define _WX_STDPATHS_H_ | |
1ee445c7 | 14 | |
07158944 VZ |
15 | #include "wx/defs.h" |
16 | ||
17 | #if wxUSE_STDPATHS | |
18 | ||
6cb5e50b VZ |
19 | #include "wx/string.h" |
20 | ||
1ee445c7 | 21 | // ---------------------------------------------------------------------------- |
96e2aec5 | 22 | // wxStandardPaths returns the standard locations in the file system |
1ee445c7 VZ |
23 | // ---------------------------------------------------------------------------- |
24 | ||
6cb5e50b | 25 | class WXDLLIMPEXP_BASE wxStandardPathsBase |
1ee445c7 VZ |
26 | { |
27 | public: | |
3af9f2de VZ |
28 | // possible resources categorires |
29 | enum ResourceCat | |
30 | { | |
31 | // no special category | |
32 | ResourceCat_None, | |
33 | ||
34 | // message catalog resources | |
35 | ResourceCat_Messages, | |
36 | ||
37 | // end of enum marker | |
38 | ResourceCat_Max | |
39 | }; | |
40 | ||
41 | ||
6cb5e50b | 42 | // return the global standard paths object |
fc480dc1 | 43 | static wxStandardPathsBase& Get(); |
48713afd VZ |
44 | |
45 | ||
1ee445c7 | 46 | // return the directory with system config files: |
6cb5e50b VZ |
47 | // /etc under Unix, c:\Documents and Settings\All Users\Application Data |
48 | // under Windows, /Library/Preferences for Mac | |
49 | virtual wxString GetConfigDir() const = 0; | |
1ee445c7 VZ |
50 | |
51 | // return the directory for the user config files: | |
52 | // $HOME under Unix, c:\Documents and Settings\username under Windows, | |
53 | // ~/Library/Preferences under Mac | |
54 | // | |
55 | // only use this if you have a single file to put there, otherwise | |
56 | // GetUserDataDir() is more appropriate | |
6cb5e50b | 57 | virtual wxString GetUserConfigDir() const = 0; |
1ee445c7 VZ |
58 | |
59 | // return the location of the applications global, i.e. not user-specific, | |
60 | // data files | |
61 | // | |
48713afd VZ |
62 | // prefix/share/appname under Unix, c:\Program Files\appname under Windows, |
63 | // appname.app/Contents/SharedSupport app bundle directory under Mac | |
6cb5e50b | 64 | virtual wxString GetDataDir() const = 0; |
1ee445c7 VZ |
65 | |
66 | // return the location for application data files which are host-specific | |
67 | // | |
68 | // same as GetDataDir() except under Unix where it is /etc/appname | |
6cb5e50b | 69 | virtual wxString GetLocalDataDir() const; |
1ee445c7 VZ |
70 | |
71 | // return the directory for the user-dependent application data files | |
72 | // | |
73 | // $HOME/.appname under Unix, | |
74 | // c:\Documents and Settings\username\Application Data\appname under Windows | |
48713afd | 75 | // and ~/Library/Application Support/appname under Mac |
6cb5e50b | 76 | virtual wxString GetUserDataDir() const = 0; |
1ee445c7 VZ |
77 | |
78 | // return the directory for user data files which shouldn't be shared with | |
79 | // the other machines | |
80 | // | |
81 | // same as GetUserDataDir() for all platforms except Windows where it is | |
82 | // the "Local Settings\Application Data\appname" directory | |
6cb5e50b | 83 | virtual wxString GetUserLocalDataDir() const; |
1ee445c7 VZ |
84 | |
85 | // return the directory where the loadable modules (plugins) live | |
86 | // | |
48713afd | 87 | // prefix/lib/appname under Unix, program directory under Windows and |
1ee445c7 | 88 | // Contents/Plugins app bundle subdirectory under Mac |
6cb5e50b VZ |
89 | virtual wxString GetPluginsDir() const = 0; |
90 | ||
3af9f2de VZ |
91 | // get resources directory: resources are auxiliary files used by the |
92 | // application and include things like image and sound files | |
93 | // | |
94 | // same as GetDataDir() for all platforms except Mac where it returns | |
95 | // Contents/Resources subdirectory of the app bundle | |
96 | virtual wxString GetResourcesDir() const { return GetDataDir(); } | |
97 | ||
98 | // get localized resources directory containing the resource files of the | |
99 | // specified category for the given language | |
100 | // | |
101 | // in general this is just GetResourcesDir()/lang under Windows and Unix | |
102 | // and GetResourcesDir()/lang.lproj under Mac but is something quite | |
103 | // different under Unix for message catalog category (namely the standard | |
104 | // prefix/share/locale/lang/LC_MESSAGES) | |
105 | virtual wxString | |
106 | GetLocalizedResourcesDir(const wxChar *lang, | |
8c943368 VZ |
107 | ResourceCat WXUNUSED(category) |
108 | = ResourceCat_None) const | |
3af9f2de VZ |
109 | { |
110 | return GetResourcesDir() + wxFILE_SEP_PATH + lang; | |
111 | } | |
112 | ||
6cb5e50b VZ |
113 | |
114 | // virtual dtor for the base class | |
115 | virtual ~wxStandardPathsBase(); | |
ce336c6d VZ |
116 | |
117 | protected: | |
118 | // append "/appname" suffix if the app name is set (doesn't append the | |
119 | // slash if dir already ends with a slash or dot) | |
120 | static wxString AppendAppName(const wxString& dir); | |
1ee445c7 VZ |
121 | }; |
122 | ||
6cb5e50b VZ |
123 | #if defined(__WXMSW__) |
124 | #include "wx/msw/stdpaths.h" | |
fc480dc1 DE |
125 | // We want CoreFoundation paths on both CarbonLib and Darwin (for all ports) |
126 | #elif defined(__WXMAC__) || defined(__DARWIN__) | |
726b98e9 | 127 | #include "wx/mac/corefoundation/stdpaths.h" |
175bb578 SN |
128 | #elif defined(__OS2__) |
129 | #include "wx/os2/stdpaths.h" | |
6cb5e50b VZ |
130 | #elif defined(__UNIX__) |
131 | #include "wx/unix/stdpaths.h" | |
a809b45d WS |
132 | #elif defined(__PALMOS__) |
133 | #include "wx/palmos/stdpaths.h" | |
46a28273 MW |
134 | #else |
135 | ||
136 | // ---------------------------------------------------------------------------- | |
d6f42b1b | 137 | // Minimal generic implementation |
46a28273 MW |
138 | // ---------------------------------------------------------------------------- |
139 | ||
140 | class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase | |
141 | { | |
142 | public: | |
143 | void SetInstallPrefix(const wxString& prefix) { m_prefix = prefix; } | |
144 | wxString GetInstallPrefix() const { return m_prefix; } | |
145 | virtual wxString GetConfigDir() const { return m_prefix; } | |
146 | virtual wxString GetUserConfigDir() const { return m_prefix; } | |
147 | virtual wxString GetDataDir() const { return m_prefix; } | |
148 | virtual wxString GetLocalDataDir() const { return m_prefix; } | |
149 | virtual wxString GetUserDataDir() const { return m_prefix; } | |
150 | virtual wxString GetPluginsDir() const { return m_prefix; } | |
151 | ||
152 | private: | |
153 | wxString m_prefix; | |
154 | }; | |
155 | ||
6cb5e50b VZ |
156 | #endif |
157 | ||
07158944 VZ |
158 | #endif // wxUSE_STDPATHS |
159 | ||
0b75a1e0 | 160 | #endif // _WX_STDPATHS_H_ |
1ee445c7 | 161 |