summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorKasper Laudrup <kasper.laudrup@man-es.com>2019-08-08 13:28:51 (GMT)
committerKasper Laudrup <kasper.laudrup@man-es.com>2019-08-08 13:59:02 (GMT)
commit5729580376da53c5665e4e3a043834ad6c7ed706 (patch)
treeb2c3c828f8ce11d6f1d86f1175ec792974d5f55d /Source/cmSystemTools.cxx
parent38a5b0203fe116268afbdb8d82fc8d89c3b213f2 (diff)
downloadCMake-5729580376da53c5665e4e3a043834ad6c7ed706.zip
CMake-5729580376da53c5665e4e3a043834ad6c7ed706.tar.gz
CMake-5729580376da53c5665e4e3a043834ad6c7ed706.tar.bz2
Use registry setting for removal retry count and delay
Instead of hardcoding the amount of retries and the time to sleep between them when removing directories on Windows, use the setting potentially present in the registry instead. This setting is already used when retrying moving directories.
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 7baf5ed..a168b33 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2838,14 +2838,20 @@ bool cmSystemTools::CheckRPath(std::string const& file,
bool cmSystemTools::RepeatedRemoveDirectory(const std::string& dir)
{
+#ifdef _WIN32
// Windows sometimes locks files temporarily so try a few times.
- for (int i = 0; i < 10; ++i) {
+ WindowsFileRetry retry = cmSystemTools::GetWindowsFileRetry();
+
+ for (unsigned int i = 0; i < retry.Count; ++i) {
if (cmSystemTools::RemoveADirectory(dir)) {
return true;
}
- cmSystemTools::Delay(100);
+ cmSystemTools::Delay(retry.Delay);
}
return false;
+#else
+ return cmSystemTools::RemoveADirectory(dir);
+#endif
}
bool cmSystemTools::StringToLong(const char* str, long* value)