]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/stdpaths.h | |
3 | // Purpose: declaration of wxStandardPaths class | |
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 | ||
12 | #ifndef _WX_STDPATHS_H_ | |
13 | #define _WX_STDPATHS_H_ | |
14 | ||
15 | #include "wx/defs.h" | |
16 | ||
17 | #if wxUSE_STDPATHS | |
18 | ||
19 | #include "wx/string.h" | |
20 | ||
21 | // ---------------------------------------------------------------------------- | |
22 | // wxStandardPaths returns the standard locations in the file system | |
23 | // ---------------------------------------------------------------------------- | |
24 | ||
25 | class WXDLLIMPEXP_BASE wxStandardPathsBase | |
26 | { | |
27 | public: | |
28 | // return the global standard paths object | |
29 | static wxStandardPathsBase& Get(); | |
30 | ||
31 | ||
32 | // return the directory with system config files: | |
33 | // /etc under Unix, c:\Documents and Settings\All Users\Application Data | |
34 | // under Windows, /Library/Preferences for Mac | |
35 | virtual wxString GetConfigDir() const = 0; | |
36 | ||
37 | // return the directory for the user config files: | |
38 | // $HOME under Unix, c:\Documents and Settings\username under Windows, | |
39 | // ~/Library/Preferences under Mac | |
40 | // | |
41 | // only use this if you have a single file to put there, otherwise | |
42 | // GetUserDataDir() is more appropriate | |
43 | virtual wxString GetUserConfigDir() const = 0; | |
44 | ||
45 | // return the location of the applications global, i.e. not user-specific, | |
46 | // data files | |
47 | // | |
48 | // prefix/share/appname under Unix, c:\Program Files\appname under Windows, | |
49 | // appname.app/Contents/SharedSupport app bundle directory under Mac | |
50 | virtual wxString GetDataDir() const = 0; | |
51 | ||
52 | // return the location for application data files which are host-specific | |
53 | // | |
54 | // same as GetDataDir() except under Unix where it is /etc/appname | |
55 | virtual wxString GetLocalDataDir() const; | |
56 | ||
57 | // return the directory for the user-dependent application data files | |
58 | // | |
59 | // $HOME/.appname under Unix, | |
60 | // c:\Documents and Settings\username\Application Data\appname under Windows | |
61 | // and ~/Library/Application Support/appname under Mac | |
62 | virtual wxString GetUserDataDir() const = 0; | |
63 | ||
64 | // return the directory for user data files which shouldn't be shared with | |
65 | // the other machines | |
66 | // | |
67 | // same as GetUserDataDir() for all platforms except Windows where it is | |
68 | // the "Local Settings\Application Data\appname" directory | |
69 | virtual wxString GetUserLocalDataDir() const; | |
70 | ||
71 | // return the directory where the loadable modules (plugins) live | |
72 | // | |
73 | // prefix/lib/appname under Unix, program directory under Windows and | |
74 | // Contents/Plugins app bundle subdirectory under Mac | |
75 | virtual wxString GetPluginsDir() const = 0; | |
76 | ||
77 | ||
78 | // virtual dtor for the base class | |
79 | virtual ~wxStandardPathsBase(); | |
80 | ||
81 | protected: | |
82 | // append "/appname" suffix if the app name is set (doesn't append the | |
83 | // slash if dir already ends with a slash or dot) | |
84 | static wxString AppendAppName(const wxString& dir); | |
85 | }; | |
86 | ||
87 | #if defined(__WXMSW__) | |
88 | #include "wx/msw/stdpaths.h" | |
89 | // We want CoreFoundation paths on both CarbonLib and Darwin (for all ports) | |
90 | #elif defined(__WXMAC__) || defined(__DARWIN__) | |
91 | #include "wx/mac/corefoundation/stdpaths.h" | |
92 | #elif defined(__OS2__) | |
93 | #include "wx/os2/stdpaths.h" | |
94 | #elif defined(__UNIX__) | |
95 | #include "wx/unix/stdpaths.h" | |
96 | #elif defined(__PALMOS__) | |
97 | #include "wx/palmos/stdpaths.h" | |
98 | #else | |
99 | ||
100 | // ---------------------------------------------------------------------------- | |
101 | // Minimal generic implementation | |
102 | // ---------------------------------------------------------------------------- | |
103 | ||
104 | class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase | |
105 | { | |
106 | public: | |
107 | void SetInstallPrefix(const wxString& prefix) { m_prefix = prefix; } | |
108 | wxString GetInstallPrefix() const { return m_prefix; } | |
109 | virtual wxString GetConfigDir() const { return m_prefix; } | |
110 | virtual wxString GetUserConfigDir() const { return m_prefix; } | |
111 | virtual wxString GetDataDir() const { return m_prefix; } | |
112 | virtual wxString GetLocalDataDir() const { return m_prefix; } | |
113 | virtual wxString GetUserDataDir() const { return m_prefix; } | |
114 | virtual wxString GetPluginsDir() const { return m_prefix; } | |
115 | ||
116 | private: | |
117 | wxString m_prefix; | |
118 | }; | |
119 | ||
120 | #endif | |
121 | ||
122 | #endif // wxUSE_STDPATHS | |
123 | ||
124 | #endif // _WX_STDPATHS_H_ | |
125 |