]> git.lyx.org Git - lyx.git/blobdiff - src/support/Path.cpp
add FileName::renameTo() method.
[lyx.git] / src / support / Path.cpp
index 890040580b8315e7ab577dcbc2e8659b81654baf..fbf48d8d1371568e5a8d019d48a5ff1d24bdc391 100644 (file)
 
 #include <config.h>
 
-// Needed to prevent the definition of the unnamed_Path macro
-// in the header file.
-
-#define PATH_C
-
 #include "support/Path.h"
 #include "support/lyxlib.h"
 
+// undef PathChanger macro when building PathChanger
+#undef PathChanger
+
 
 namespace lyx {
 namespace support {
@@ -28,7 +26,7 @@ PathChanger::PathChanger(FileName const & path)
        if (!path.empty()) {
                pushedDir_ = getcwd();
 
-               if (pushedDir_.empty() || chdir(path)) {
+               if (pushedDir_.empty() || !path.chdir()) {
                        /* FIXME: throw */
                }
        } else {
@@ -52,7 +50,7 @@ int PathChanger::pop()
                return 0;
        }
 
-       if (chdir(pushedDir_)) {
+       if (!pushedDir_.chdir()) {
                // should throw an exception
                // throw DirChangeError();
        }
@@ -63,3 +61,7 @@ int PathChanger::pop()
 
 } // namespace support
 } // namespace lyx
+
+
+#define PathChanger(x) unnamed_PathChanger;
+// in merged builds this is not the last line.