Revert r114320(move file = copy + delete on Win32). r115040 is a better solution...
authorFrancois Pichet <pichet2000@gmail.com>
Thu, 30 Sep 2010 00:44:58 +0000 (00:44 +0000)
committerFrancois Pichet <pichet2000@gmail.com>
Thu, 30 Sep 2010 00:44:58 +0000 (00:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115114 91177308-0d34-0410-b5e6-96231b3b80d8

lib/System/Win32/Path.inc

index 64e7025fc9bf393a94161607496ed0066e2ca058..4a6dbd3ddf29999aa41c9e1fbe1613afdc3ee9f6 100644 (file)
@@ -745,19 +745,12 @@ bool Path::getMagicNumber(std::string& Magic, unsigned len) const {
   return true;
 }
 
-// Implements renamePathOnDisk as a CopyFile + eraseFromDisk on Windows.
-// Using MoveFileEx was causing mysterious ACCESS_DENIED error when used
-// within a multithreaded lit/python context.
-// FIXME: put back MoveFileEx when the source of the problem is resolved.
 bool
 Path::renamePathOnDisk(const Path& newName, std::string* ErrMsg) {
-  if (*this == newName)
-    return false;
-  
-  if (CopyFile(newName, *this, ErrMsg))
-    return true;
-  
-  return eraseFromDisk(true, ErrMsg);
+  if (!MoveFileEx(path.c_str(), newName.c_str(), MOVEFILE_REPLACE_EXISTING))
+    return MakeErrMsg(ErrMsg, "Can't move '" + path + "' to '" + newName.path
+        + "': ");
+  return false;
 }
 
 bool