diff options
| -rw-r--r-- | Source/CPack/cmCPackFreeBSDGenerator.cxx | 5 | ||||
| -rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 4 | ||||
| -rw-r--r-- | Source/cmWorkingDirectory.h | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx index e3cc352..b673006 100644 --- a/Source/CPack/cmCPackFreeBSDGenerator.cxx +++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx @@ -8,6 +8,7 @@ #include "cmGeneratedFileStream.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" +#include "cmWorkingDirectory.h" // Needed for ::open() and ::stat() #include <algorithm> @@ -285,8 +286,7 @@ int cmCPackFreeBSDGenerator::PackageFiles() } std::vector<std::string>::const_iterator fileIt; - std::string dir = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(toplevel); + cmWorkingDirectory wd(toplevel); files.erase(std::remove_if(files.begin(), files.end(), ignore_file), files.end()); @@ -332,6 +332,5 @@ int cmCPackFreeBSDGenerator::PackageFiles() } } - cmSystemTools::ChangeDirectory(dir); return 1; } diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 712eb77..43f0d3c 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -402,7 +402,6 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( } /* rebuild symlinks in the installed tree */ if (!symlinkedFiles.empty()) { - std::string curDir = cmSystemTools::GetCurrentWorkingDirectory(); std::string goToDir = cmStrCat(tempDir, '/', subdir); cmCPackLogger(cmCPackLog::LOG_DEBUG, "Change dir to: " << goToDir << std::endl); @@ -441,7 +440,8 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( } } cmCPackLogger(cmCPackLog::LOG_DEBUG, - "Going back to: " << curDir << std::endl); + "Going back to: " << workdir.GetOldDirectory() + << std::endl); } } } diff --git a/Source/cmWorkingDirectory.h b/Source/cmWorkingDirectory.h index d4a164d..4c7576d 100644 --- a/Source/cmWorkingDirectory.h +++ b/Source/cmWorkingDirectory.h @@ -37,6 +37,8 @@ public: */ int GetLastResult() const { return ResultCode; } + std::string const& GetOldDirectory() const { return this->OldDir; } + private: std::string OldDir; int ResultCode; |
