| Index: runtime/bin/file_win.cc
|
| diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc
|
| index 5d78d197e69acccb7802a4b3ec9512ae298be337..1c22ededcf24a42cf4e9f11b88c82581a71948d3 100644
|
| --- a/runtime/bin/file_win.cc
|
| +++ b/runtime/bin/file_win.cc
|
| @@ -272,7 +272,27 @@ File::StdioHandleType File::GetStdioHandleType(int fd) {
|
|
|
|
|
| File::Type File::GetType(const char* pathname, bool follow_links) {
|
| - return File::kDoesNotExist;
|
| + const wchar_t* name = StringUtils::Utf8ToWide(pathname);
|
| + WIN32_FIND_DATAW file_data;
|
| + HANDLE find_handle = FindFirstFileW(name, &file_data);
|
| + if (find_handle == INVALID_HANDLE_VALUE) {
|
| + // TODO(whesse): Distinguish other errors from does not exist.
|
| + return File::kDoesNotExist;
|
| + }
|
| + DWORD attributes = file_data.dwFileAttributes;
|
| + if (!follow_links && (attributes & FILE_ATTRIBUTE_REPARSE_POINT) != 0) {
|
| + DWORD reparse_tag = file_data.dwReserved0;
|
| + if (reparse_tag == IO_REPARSE_TAG_SYMLINK ||
|
| + reparse_tag == IO_REPARSE_TAG_MOUNT_POINT) {
|
| + return File::kIsLink;
|
| + } else {
|
| + return File::kDoesNotExist;
|
| + }
|
| + } else if ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0) {
|
| + return File::kIsDirectory;
|
| + } else {
|
| + return File::kIsFile;
|
| + }
|
| }
|
|
|
| #endif // defined(TARGET_OS_WINDOWS)
|
|
|