summaryrefslogtreecommitdiffstats
path: root/Source/CPack
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-04-03 13:43:04 (GMT)
committerBrad King <brad.king@kitware.com>2020-04-03 13:55:49 (GMT)
commit753817e71d6c3798fe2d85ac21c93d25a86f59b9 (patch)
tree8738561ad79e969e1bf2d7d080b6e376fdc48b62 /Source/CPack
parentf4e4b41a19ac5accf48e3a70c93f7d901df05136 (diff)
downloadCMake-753817e71d6c3798fe2d85ac21c93d25a86f59b9.zip
CMake-753817e71d6c3798fe2d85ac21c93d25a86f59b9.tar.gz
CMake-753817e71d6c3798fe2d85ac21c93d25a86f59b9.tar.bz2
CPack/FreeBSD: Use RAII to save/restore working directory
Diffstat (limited to 'Source/CPack')
-rw-r--r--Source/CPack/cmCPackFreeBSDGenerator.cxx5
1 files changed, 2 insertions, 3 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;
}