]> git.lyx.org Git - lyx.git/blobdiff - src/support/path.h
* lyxfunctional.h: delete compare_memfun and helper classes
[lyx.git] / src / support / path.h
index 96a057cd164ee47b2efb5c48f71f578b024d42b0..2d1c43875b681edf814258c0283dec5752e08f56 100644 (file)
 #ifndef PATH_H
 #define PATH_H
 
-#include "LString.h"
-#include "lyxlib.h"
 #include <boost/utility.hpp>
 
+#include <string>
+
 namespace lyx {
 namespace support {
 
@@ -35,24 +35,10 @@ namespace support {
 class Path : boost::noncopyable {
 public:
        /// change to the given directory
-       explicit
-       Path(string const & path)
-               : popped_(false)
-       {
-               if (!path.empty()) {
-                       pushedDir_ = getcwd();
-                       if (pushedDir_.empty() || 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();
@@ -60,7 +46,7 @@ private:
        /// whether we are in the new cwd or not
        bool popped_;
        /// the previous cwd
-       string pushedDir_;
+       std::string pushedDir_;
 };
 
 // To avoid the wrong usage:
@@ -68,7 +54,9 @@ private:
 // Path p("/tmp");  // right
 // we add this macro:
 ///
+#ifndef PATH_C
 #define Path(x) unnamed_Path;
+#endif
 // Tip gotten from Bobby Schmidt's column in C/C++ Users Journal
 
 } // namespace support