*
* \author Lars Gullik Bjønnes
*
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
*/
#ifndef PATH_H
#define PATH_H
-#include "LString.h"
-//#include "filetools.h"
-#include "lyxlib.h"
#include <boost/utility.hpp>
-#ifdef __GNUG__
-#pragma interface
-#endif
+#include <string>
+namespace lyx {
+namespace support {
/**
* Path - utility closs for stackable working directories
class Path : boost::noncopyable {
public:
/// change to the given directory
- explicit
- Path(string const & path)
- : popped_(false)
- {
- if (!path.empty()) {
- pushedDir_ = lyx::getcwd();
- if (pushedDir_.empty() || lyx::chdir(path))
- /* FIXME: throw */;
- } else {
- popped_ = true;
- }
- }
+ explicit Path(std::string const & path);
/// set cwd to the previous value if needed
- ~Path()
- {
- if (!popped_) pop();
- }
+ ~Path();
/// set cwd to the previous value if needed
int pop();
/// whether we are in the new cwd or not
bool popped_;
/// the previous cwd
- string pushedDir_;
+ std::string pushedDir_;
};
// To avoid the wrong usage:
// Path p("/tmp"); // right
// we add this macro:
///
-#define Path(x) unnamed_Path;
+// With boost 1.34 this is not usable anymore
+//#ifndef PATH_C
+//#define Path(x) unnamed_Path;
+//#endif
// Tip gotten from Bobby Schmidt's column in C/C++ Users Journal
+} // namespace support
+} // namespace lyx
+
#endif // PATH_H