aboutsummaryrefslogtreecommitdiffstats
path: root/lib/System/Win32
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-07-28 22:36:17 +0000
committerChris Lattner <sabre@nondot.org>2006-07-28 22:36:17 +0000
commit1bebfb5ae4c240064beffe3232402ea68b110510 (patch)
tree0d59f9af15c52cd83501cdba2433146f3a378d8e /lib/System/Win32
parent7dea1019c1dcf2f9198397ca290784db092b75af (diff)
downloadexternal_llvm-1bebfb5ae4c240064beffe3232402ea68b110510.zip
external_llvm-1bebfb5ae4c240064beffe3232402ea68b110510.tar.gz
external_llvm-1bebfb5ae4c240064beffe3232402ea68b110510.tar.bz2
Modify setStatusInfoOnDisk to not throw an exception.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29402 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Win32')
-rw-r--r--lib/System/Win32/Path.inc16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/System/Win32/Path.inc b/lib/System/Win32/Path.inc
index a7c7d21..7c14ea7 100644
--- a/lib/System/Win32/Path.inc
+++ b/lib/System/Win32/Path.inc
@@ -693,9 +693,9 @@ Path::renamePathOnDisk(const Path& newName) {
}
bool
-Path::setStatusInfoOnDisk(const FileStatus &si) const {
+Path::setStatusInfoOnDisk(const FileStatus &si, std::string *ErrStr) const {
// FIXME: should work on directories also.
- if (!isFile()) return false;
+ if (!isFile()) return true;
HANDLE h = CreateFile(path.c_str(),
FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES,
@@ -705,14 +705,14 @@ Path::setStatusInfoOnDisk(const FileStatus &si) const {
FILE_ATTRIBUTE_NORMAL,
NULL);
if (h == INVALID_HANDLE_VALUE)
- return false;
+ return true;
BY_HANDLE_FILE_INFORMATION bhfi;
if (!GetFileInformationByHandle(h, &bhfi)) {
DWORD err = GetLastError();
CloseHandle(h);
SetLastError(err);
- ThrowError(path + ": GetFileInformationByHandle: ");
+ return GetError(path + ": GetFileInformationByHandle: ", ErrStr);
}
FILETIME ft;
@@ -722,7 +722,7 @@ Path::setStatusInfoOnDisk(const FileStatus &si) const {
CloseHandle(h);
if (!ret) {
SetLastError(err);
- ThrowError(path + ": SetFileTime: ");
+ return GetError(path + ": SetFileTime: ", ErrStr);
}
// Best we can do with Unix permission bits is to interpret the owner
@@ -731,17 +731,17 @@ Path::setStatusInfoOnDisk(const FileStatus &si) const {
if (bhfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
if (!SetFileAttributes(path.c_str(),
bhfi.dwFileAttributes & ~FILE_ATTRIBUTE_READONLY))
- ThrowError(path + ": SetFileAttributes: ");
+ return GetError(path + ": SetFileAttributes: ", ErrStr);
}
} else {
if (!(bhfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) {
if (!SetFileAttributes(path.c_str(),
bhfi.dwFileAttributes | FILE_ATTRIBUTE_READONLY))
- ThrowError(path + ": SetFileAttributes: ");
+ return GetError(path + ": SetFileAttributes: ", ErrStr);
}
}
- return true;
+ return false;
}
void