[PATCH] D17903: Improve reliability of file renaming in Windows

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 18 09:02:03 PDT 2016


rnk added inline comments.

================
Comment at: lib/Support/Windows/Path.inc:271
@@ +270,3 @@
+      // with the destination even if the destination file is currently open.
+      if (::ReplaceFileW(wide_to.begin(), wide_from.begin(), NULL, 0, NULL,
+                         NULL))
----------------
These begin() calls should be data() calls.

================
Comment at: lib/Support/Windows/Path.inc:281
@@ +280,3 @@
+      if (ReplaceError == ERROR_UNABLE_TO_MOVE_REPLACEMENT ||
+          ReplaceError == ERROR_UNABLE_TO_MOVE_REPLACEMENT_2) {
+        TryReplace = false;
----------------
MSDN says this for ERROR_UNABLE_TO_MOVE_REPLACEMENT_2:
"The file to be replaced still exists with a different name."

Should we do anything about that?


http://reviews.llvm.org/D17903





More information about the llvm-commits mailing list