Chromium Code Reviews| Index: runtime/bin/file_win.cc |
| diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc |
| index e18071aacae8c871336394e4b4c05ba85dca5e08..92c7c157fb94113d05f0c90342f71a64f026cce3 100644 |
| --- a/runtime/bin/file_win.cc |
| +++ b/runtime/bin/file_win.cc |
| @@ -270,4 +270,24 @@ File::StdioHandleType File::GetStdioHandleType(int fd) { |
| return kPipe; |
| } |
| + |
| +File::Type File::GetType(const char* pathname, bool follow_links) { |
| + struct _stat entry_info; |
| + const wchar_t* system_name = StringUtils::Utf8ToWide(pathname); |
| + // TODO(whesse): We need to use FileGetAttributes here, and more complex |
| + // checks. |
| + int stat_success = _wstat(system_name, &st); |
| + free(const_cast<wchar_t*>(system_name)); |
| + if (stat_success == -1) return File::kDoesNotExist; |
| + if (S_ISDIR(entry_info.st_mode)) return File::kIsDirectory; |
| + if (S_ISREG(entry_info.st_mode)) return File::kIsFile; |
| + // if (S_ISLNK(entry_info.st_mode)) return File::kIsLink; |
|
Bob Nystrom
2013/03/06 19:02:52
What kind of symlinks does this detect? For what i
Bill Hesse
2013/03/07 09:53:12
The Windows implementation will report all types o
|
| + return File::kDoesNotExist; |
| +} |
| + |
| + struct _stat st; |
| + const wchar_t* system_name = StringUtils::Utf8ToWide(name); |
| + int stat_status = _wstat(system_name, &st); |
| + free(const_cast<wchar_t*>(system_name)); |
| + |
| #endif // defined(TARGET_OS_WINDOWS) |