forked from OSchip/llvm-project
[Support][Windows] Prevent 2s delay when renaming a file that does not exist
Differential Revision: https://reviews.llvm.org/D82542
This commit is contained in:
parent
7f903873b8
commit
a27478e54f
|
@ -555,6 +555,11 @@ std::error_code rename(const Twine &From, const Twine &To) {
|
||||||
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
if (FromHandle)
|
if (FromHandle)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// We don't want to loop if the file doesn't exist.
|
||||||
|
auto EC = mapWindowsError(GetLastError());
|
||||||
|
if (EC == errc::no_such_file_or_directory)
|
||||||
|
return EC;
|
||||||
}
|
}
|
||||||
if (!FromHandle)
|
if (!FromHandle)
|
||||||
return mapWindowsError(GetLastError());
|
return mapWindowsError(GetLastError());
|
||||||
|
|
Loading…
Reference in New Issue