mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-22 06:59:01 -06:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user