summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRon W Moore <webbtrail@gmail.com>2020-08-25 13:44:56 (GMT)
committerBrad King <brad.king@kitware.com>2020-08-31 17:03:36 (GMT)
commitd78c22aa64f63b06b39c644c5d65aee367ec74b4 (patch)
tree2a490f7c40c03059e08ac6d695e15041c3eca2c8
parent73f8240ae7594121704a8aa43d7ef25e8ffd2f75 (diff)
downloadCMake-d78c22aa64f63b06b39c644c5d65aee367ec74b4.zip
CMake-d78c22aa64f63b06b39c644c5d65aee367ec74b4.tar.gz
CMake-d78c22aa64f63b06b39c644c5d65aee367ec74b4.tar.bz2
cmSystemTools: Improve RenameFile on Windows with MOVEFILE_WRITE_THROUGH
Add this flag to tell `MoveFileExW` to flush the rename to disk before returning. Issue: #19580
-rw-r--r--Source/cmSystemTools.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index b63c318..3cea743 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -885,8 +885,10 @@ void cmSystemTools::InitializeLibUV()
namespace {
bool cmMoveFile(std::wstring const& oldname, std::wstring const& newname)
{
+ // Use MOVEFILE_REPLACE_EXISTING to replace an existing destination file.
+ // Use MOVEFILE_WRITE_THROUGH to flush the change to disk before returning.
return MoveFileExW(oldname.c_str(), newname.c_str(),
- MOVEFILE_REPLACE_EXISTING);
+ MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH);
}
}
#endif