1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00

Fix the "unable to rename temporary" lit test failing on Windows. rename is now copy + delete on Windows. Problem to be revisited for a permanent and clean solution.

llvm-svn: 114320
This commit is contained in:
Francois Pichet 2010-09-20 04:03:07 +00:00
parent aaae01e0d2
commit 53617de15e

View File

@ -745,12 +745,19 @@ bool Path::getMagicNumber(std::string& Magic, unsigned len) const {
return true; 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 bool
Path::renamePathOnDisk(const Path& newName, std::string* ErrMsg) { Path::renamePathOnDisk(const Path& newName, std::string* ErrMsg) {
if (!MoveFileEx(path.c_str(), newName.c_str(), MOVEFILE_REPLACE_EXISTING)) if (*this == newName)
return MakeErrMsg(ErrMsg, "Can't move '" + path + "' to '" + newName.path
+ "': ");
return false; return false;
if (CopyFile(newName, *this, ErrMsg))
return true;
return eraseFromDisk(true, ErrMsg);
} }
bool bool