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