Debian Codegraph @

wxcrafter/src/DirectoryChanger.h

raw
1 #ifndef DIRECTORY_CHANGER_H
2 #define DIRECTORY_CHANGER_H
3
4 #include <wx/filefn.h>
5 #include <wx/string.h>
6
7 class DirectoryChanger
8 {
9 wxString m_oldPath;
10
11 public:
12 DirectoryChanger(const wxString& path)
13 {
14 m_oldPath = ::wxGetCwd();
15 ::wxSetWorkingDirectory(path);
16 }
17
18 ~DirectoryChanger() { ::wxSetWorkingDirectory(m_oldPath); }
19 };
20
21 #endif // DIRECTORY_CHANGER_H