| 1 | /////////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: wx/msw/stdpaths.h |
| 3 | // Purpose: wxStandardPaths for Win32 |
| 4 | // Author: Vadim Zeitlin |
| 5 | // Modified by: |
| 6 | // Created: 2004-10-19 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org> |
| 9 | // Licence: wxWindows licence |
| 10 | /////////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #ifndef _WX_MSW_STDPATHS_H_ |
| 13 | #define _WX_MSW_STDPATHS_H_ |
| 14 | |
| 15 | // ---------------------------------------------------------------------------- |
| 16 | // wxStandardPaths |
| 17 | // ---------------------------------------------------------------------------- |
| 18 | |
| 19 | class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase |
| 20 | { |
| 21 | public: |
| 22 | // ctor calls IgnoreAppBuildSubDirs() and also sets up the object to use |
| 23 | // both vendor and application name by default |
| 24 | wxStandardPaths(); |
| 25 | |
| 26 | // implement base class pure virtuals |
| 27 | virtual wxString GetExecutablePath() const; |
| 28 | virtual wxString GetConfigDir() const; |
| 29 | virtual wxString GetUserConfigDir() const; |
| 30 | virtual wxString GetDataDir() const; |
| 31 | virtual wxString GetUserDataDir() const; |
| 32 | virtual wxString GetUserLocalDataDir() const; |
| 33 | virtual wxString GetPluginsDir() const; |
| 34 | virtual wxString GetDocumentsDir() const; |
| 35 | |
| 36 | |
| 37 | // MSW-specific methods |
| 38 | |
| 39 | // This class supposes that data, plugins &c files are located under the |
| 40 | // program directory which is the directory containing the application |
| 41 | // binary itself. But sometimes this binary may be in a subdirectory of the |
| 42 | // main program directory, e.g. this happens in at least the following |
| 43 | // common cases: |
| 44 | // 1. The program is in "bin" subdirectory of the installation directory. |
| 45 | // 2. The program is in "debug" subdirectory of the directory containing |
| 46 | // sources and data files during development |
| 47 | // |
| 48 | // By calling this function you instruct the class to remove the last |
| 49 | // component of the path if it matches its argument. Notice that it may be |
| 50 | // called more than once, e.g. you can call both IgnoreAppSubDir("bin") and |
| 51 | // IgnoreAppSubDir("debug") to take care of both production and development |
| 52 | // cases above but that each call will only remove the last path component. |
| 53 | // Finally note that the argument can contain wild cards so you can also |
| 54 | // call IgnoreAppSubDir("vc*msw*") to ignore all build directories at once |
| 55 | // when using wxWidgets-inspired output directories names. |
| 56 | void IgnoreAppSubDir(const wxString& subdirPattern); |
| 57 | |
| 58 | // This function is used to ignore all common build directories and is |
| 59 | // called from the ctor -- use DontIgnoreAppSubDir() to undo this. |
| 60 | void IgnoreAppBuildSubDirs(); |
| 61 | |
| 62 | // Undo the effects of all preceding IgnoreAppSubDir() calls. |
| 63 | void DontIgnoreAppSubDir(); |
| 64 | |
| 65 | |
| 66 | // Returns the directory corresponding to the specified Windows shell CSIDL |
| 67 | static wxString MSWGetShellDir(int csidl); |
| 68 | |
| 69 | protected: |
| 70 | // get the path corresponding to the given standard CSIDL_XXX constant |
| 71 | static wxString DoGetDirectory(int csidl); |
| 72 | |
| 73 | // return the directory of the application itself |
| 74 | wxString GetAppDir() const; |
| 75 | |
| 76 | // directory returned by GetAppDir() |
| 77 | mutable wxString m_appDir; |
| 78 | }; |
| 79 | |
| 80 | // ---------------------------------------------------------------------------- |
| 81 | // wxStandardPathsWin16: this class is for internal use only |
| 82 | // ---------------------------------------------------------------------------- |
| 83 | |
| 84 | // override config file locations to be compatible with the values used by |
| 85 | // wxFileConfig (dating from Win16 days which explains the class name) |
| 86 | class WXDLLIMPEXP_BASE wxStandardPathsWin16 : public wxStandardPaths |
| 87 | { |
| 88 | public: |
| 89 | virtual wxString GetConfigDir() const; |
| 90 | virtual wxString GetUserConfigDir() const; |
| 91 | }; |
| 92 | |
| 93 | #endif // _WX_MSW_STDPATHS_H_ |