Debian Codegraph @

CodeLite/clDirChanger.hpp

raw
1 #ifndef CLDIRCHANGER_HPP
2 #define CLDIRCHANGER_HPP
3
4 #include "codelite_events.h"
5 #include <wx/string.h>
6
7 class WXDLLIMPEXP_CL clDirChanger
8 {
9 protected:
10 wxString m_oldDirectory;
11
12 public:
13 clDirChanger(const wxString& newDirectory)
14 {
15 m_oldDirectory = ::wxGetCwd();
16 if(!newDirectory.IsEmpty()) {
17 ::wxSetWorkingDirectory(newDirectory);
18 }
19 }
20 virtual ~clDirChanger() { ::wxSetWorkingDirectory(m_oldDirectory); }
21 };
22
23 #endif // CLDIRCHANGER_HPP