diff options
Diffstat (limited to 'llvm/lib/System/Win32')
-rw-r--r-- | llvm/lib/System/Win32/Path.inc | 6 | ||||
-rw-r--r-- | llvm/lib/System/Win32/Win32.h | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/System/Win32/Path.inc b/llvm/lib/System/Win32/Path.inc index 913a4091aca..ece5727151b 100644 --- a/llvm/lib/System/Win32/Path.inc +++ b/llvm/lib/System/Win32/Path.inc @@ -651,10 +651,10 @@ bool Path::getMagicNumber(std::string& Magic, unsigned len) const { } bool -Path::renamePathOnDisk(const Path& newName) { +Path::renamePathOnDisk(const Path& newName, std::string* ErrMsg) { if (!MoveFileEx(path.c_str(), newName.c_str(), MOVEFILE_REPLACE_EXISTING)) - ThrowError("Can't move '" + path + - "' to '" + newName.path + "': "); + return MakeErrMsg(ErrMsg, "Can't move '" + path + "' to '" + newName.path + + "': "); return true; } diff --git a/llvm/lib/System/Win32/Win32.h b/llvm/lib/System/Win32/Win32.h index 7243548cda4..2238faa8485 100644 --- a/llvm/lib/System/Win32/Win32.h +++ b/llvm/lib/System/Win32/Win32.h @@ -44,14 +44,15 @@ inline void ThrowError(const std::string& msg) { throw s; } -inline void MakeErrMsg(std::string* ErrMsg, const std::string& prefix) { +inline bool MakeErrMsg(std::string* ErrMsg, const std::string& prefix) { if (!ErrMsg) - return; + return true; char *buffer = NULL; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, (LPSTR)&buffer, 1, NULL); ErrMsg = prefix + buffer; LocalFree(buffer); + return true; } inline void ThrowErrno(const std::string& prefix) { |