summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Windows/Path.inc
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-07-30 20:25:53 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-07-30 20:25:53 +0000
commita5932afef06bbb5bd556a6cd443b394a40e43263 (patch)
tree12e7fd2acdba5f98be2d3728b4b090821ba19c80 /llvm/lib/Support/Windows/Path.inc
parent5973e8371a797633ddd55f22c8cc53ae8cd06e9e (diff)
downloadbcm5719-llvm-a5932afef06bbb5bd556a6cd443b394a40e43263.tar.gz
bcm5719-llvm-a5932afef06bbb5bd556a6cd443b394a40e43263.zip
Implement getUniqueID for directories on windows.
llvm-svn: 187441
Diffstat (limited to 'llvm/lib/Support/Windows/Path.inc')
-rw-r--r--llvm/lib/Support/Windows/Path.inc32
1 files changed, 14 insertions, 18 deletions
diff --git a/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc
index a0724e55513..c1dac918635 100644
--- a/llvm/lib/Support/Windows/Path.inc
+++ b/llvm/lib/Support/Windows/Path.inc
@@ -592,12 +592,17 @@ static error_code getStatus(HANDLE FileHandle, file_status &Result) {
if (!::GetFileInformationByHandle(FileHandle, &Info))
goto handle_status_error;
- Result = file_status(
- file_type::regular_file, Info.ftLastWriteTime.dwHighDateTime,
- Info.ftLastWriteTime.dwLowDateTime, Info.dwVolumeSerialNumber,
- Info.nFileSizeHigh, Info.nFileSizeLow, Info.nFileIndexHigh,
- Info.nFileIndexLow);
- return error_code::success();
+ {
+ file_type Type = (Info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ ? file_type::directory_file
+ : file_type::regular_file;
+ Result =
+ file_status(Type, Info.ftLastWriteTime.dwHighDateTime,
+ Info.ftLastWriteTime.dwLowDateTime,
+ Info.dwVolumeSerialNumber, Info.nFileSizeHigh,
+ Info.nFileSizeLow, Info.nFileIndexHigh, Info.nFileIndexLow);
+ return error_code::success();
+ }
handle_status_error:
error_code EC = windows_error(::GetLastError());
@@ -644,23 +649,14 @@ error_code status(const Twine &path, file_status &result) {
return getStatus(INVALID_HANDLE_VALUE, result);
}
- if (attr & FILE_ATTRIBUTE_DIRECTORY)
- result = file_status(file_type::directory_file);
- else {
- ScopedFileHandle h(
- ::CreateFileW(path_utf16.begin(),
- 0, // Attributes only.
+ ScopedFileHandle h(
+ ::CreateFileW(path_utf16.begin(), 0, // Attributes only.
FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
- OPEN_EXISTING,
- FILE_FLAG_BACKUP_SEMANTICS,
- 0));
+ NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0));
if (!h)
return getStatus(INVALID_HANDLE_VALUE, result);
return getStatus(h, result);
- }
- return error_code::success();
}
error_code status(int FD, file_status &Result) {
OpenPOWER on IntegriCloud