diff options
author | Brad King <brad.king@kitware.com> | 2010-06-07 18:33:38 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2010-06-07 18:33:38 (GMT) |
commit | 6f96e32bfd2dcd6fd94e65083da90be99b4f0316 (patch) | |
tree | b216667d3e2a663c2b9ed4191f5dabb1c72ffc57 /Source | |
parent | efffb7b9791fd19842a745ef09890b0c45a7974f (diff) | |
parent | fdb5f78705f1a603d176a0976c931dd197567ff9 (diff) | |
download | CMake-6f96e32bfd2dcd6fd94e65083da90be99b4f0316.zip CMake-6f96e32bfd2dcd6fd94e65083da90be99b4f0316.tar.gz CMake-6f96e32bfd2dcd6fd94e65083da90be99b4f0316.tar.bz2 |
Merge branch 'cpack-remove-temp-dir'
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 15 | ||||
-rw-r--r-- | Source/cmSystemTools.h | 3 |
3 files changed, 20 insertions, 2 deletions
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 6224b40..4a4b428 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -789,7 +789,7 @@ int cmCPackGenerator::DoPackage() cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Remove toplevel directory: " << toplevelDirectory << std::endl); - if ( !cmSystemTools::RemoveADirectory(toplevelDirectory) ) + if ( !cmSystemTools::RepeatedRemoveDirectory(toplevelDirectory) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem removing toplevel directory: " @@ -1084,7 +1084,7 @@ int cmCPackGenerator::CleanTemporaryDirectory() cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Clean temporary : " << tempInstallDirectory << std::endl); - if(!cmsys::SystemTools::RemoveADirectory(tempInstallDirectory)) + if(!cmSystemTools::RepeatedRemoveDirectory(tempInstallDirectory)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem removing temporary directory: " << diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index d914203..5f7cfa3 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2938,3 +2938,18 @@ bool cmSystemTools::CheckRPath(std::string const& file, return false; #endif } + +//---------------------------------------------------------------------------- +bool cmSystemTools::RepeatedRemoveDirectory(const char* dir) +{ + // Windows sometimes locks files temporarily so try a few times. + for(int i = 0; i < 10; ++i) + { + if(cmSystemTools::RemoveADirectory(dir)) + { + return true; + } + cmSystemTools::Delay(100); + } + return false; +} diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index ed924dd..da5da31 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -436,6 +436,9 @@ public: static bool CheckRPath(std::string const& file, std::string const& newRPath); + /** Remove a directory; repeat a few times in case of locked files. */ + static bool RepeatedRemoveDirectory(const char* dir); + private: static bool s_ForceUnixPaths; static bool s_RunCommandHideConsole; |