]> git.lyx.org Git - lyx.git/blobdiff - src/support/path.h
fix compiler warnings about unused parameter
[lyx.git] / src / support / path.h
index 1e71fbad88edb496dc57e9cc42672b8f11f9be12..13296353aa6a87ce6b919773e6c2804915cb1663 100644 (file)
@@ -6,16 +6,18 @@
  *
  * \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 "lyxlib.h"
+#include "support/filename.h"
+
 #include <boost/utility.hpp>
 
+#include <string>
+
 namespace lyx {
 namespace support {
 
@@ -35,24 +37,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 +48,7 @@ private:
        /// whether we are in the new cwd or not
        bool popped_;
        /// the previous cwd
-       string pushedDir_;
+       FileName pushedDir_;
 };
 
 // To avoid the wrong usage:
@@ -68,7 +56,10 @@ private:
 // 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