Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(859)

Unified Diff: runtime/bin/file_win.cc

Issue 2616463004: Signal an error for File.lastModified on a directory (Closed)
Patch Set: Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/file_macos.cc ('k') | tests/standalone/io/file_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « runtime/bin/file_macos.cc ('k') | tests/standalone/io/file_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698