Index: runtime/bin/file_win.cc |
diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc |
index b226e80157f92edb459115fb9acefd38e6b3ef8e..3cfdf69b2158b368b5b2a6026236e91f65ebad7c 100644 |
--- a/runtime/bin/file_win.cc |
+++ b/runtime/bin/file_win.cc |
@@ -544,7 +544,12 @@ time_t File::LastModified(const char* name) { |
Utf8ToWideScope system_name(name); |
int stat_status = _wstat64(system_name.wide(), &st); |
if (stat_status == 0) { |
- return st.st_mtime; |
+ if ((st.st_mode & S_IFMT) == S_IFREG) { |
+ return st.st_mtime; |
+ } else { |
+ // ERROR_DIRECTORY_NOT_SUPPORTED is not always in the message table. |
+ SetLastError(ERROR_NOT_SUPPORTED); |
+ } |
} |
return -1; |
} |