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 // Copyright:   (c) 2004 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence:     wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10 
11 #ifndef _WX_MSW_STDPATHS_H_
12 #define _WX_MSW_STDPATHS_H_
13 
14 struct _GUID;
15 
16 // ----------------------------------------------------------------------------
17 // wxStandardPaths
18 // ----------------------------------------------------------------------------
19 
20 class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase
21 {
22 public:
23     // implement base class pure virtuals
24     virtual wxString GetExecutablePath() const wxOVERRIDE;
25     virtual wxString GetConfigDir() const wxOVERRIDE;
26     virtual wxString GetUserConfigDir() const wxOVERRIDE;
27     virtual wxString GetDataDir() const wxOVERRIDE;
28     virtual wxString GetUserDataDir() const wxOVERRIDE;
29     virtual wxString GetUserLocalDataDir() const wxOVERRIDE;
30     virtual wxString GetPluginsDir() const wxOVERRIDE;
31     virtual wxString GetUserDir(Dir userDir) const wxOVERRIDE;
32     virtual wxString MakeConfigFileName(const wxString& basename,
33                                         ConfigFileConv conv = ConfigFileConv_Ext
34                                         ) const wxOVERRIDE;
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     // Ctor is protected, use wxStandardPaths::Get() instead of instantiating
71     // objects of this class directly.
72     //
73     // It calls IgnoreAppBuildSubDirs() and also sets up the object to use
74     // both vendor and application name by default.
75     wxStandardPaths();
76 
77     // get the path corresponding to the given standard CSIDL_XXX constant
78     static wxString DoGetDirectory(int csidl);
79 
80     static wxString DoGetKnownFolder(const _GUID& rfid);
81 
82     // return the directory of the application itself
83     wxString GetAppDir() const;
84 
85     // directory returned by GetAppDir()
86     mutable wxString m_appDir;
87 };
88 
89 // ----------------------------------------------------------------------------
90 // wxStandardPathsWin16: this class is for internal use only
91 // ----------------------------------------------------------------------------
92 
93 // override config file locations to be compatible with the values used by
94 // wxFileConfig (dating from Win16 days which explains the class name)
95 class WXDLLIMPEXP_BASE wxStandardPathsWin16 : public wxStandardPaths
96 {
97 public:
98     virtual wxString GetConfigDir() const wxOVERRIDE;
99     virtual wxString GetUserConfigDir() const wxOVERRIDE;
100 };
101 
102 #endif // _WX_MSW_STDPATHS_H_
103