OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
6 #if defined(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
7 | 7 |
8 #include "bin/file.h" | 8 #include "bin/file.h" |
9 | 9 |
10 #include <fcntl.h> // NOLINT | 10 #include <fcntl.h> // NOLINT |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 } | 537 } |
538 } | 538 } |
539 } | 539 } |
540 | 540 |
541 | 541 |
542 time_t File::LastModified(const char* name) { | 542 time_t File::LastModified(const char* name) { |
543 struct __stat64 st; | 543 struct __stat64 st; |
544 Utf8ToWideScope system_name(name); | 544 Utf8ToWideScope system_name(name); |
545 int stat_status = _wstat64(system_name.wide(), &st); | 545 int stat_status = _wstat64(system_name.wide(), &st); |
546 if (stat_status == 0) { | 546 if (stat_status == 0) { |
547 return st.st_mtime; | 547 if ((st.st_mode & S_IFMT) == S_IFREG) { |
| 548 return st.st_mtime; |
| 549 } else { |
| 550 // ERROR_DIRECTORY_NOT_SUPPORTED is not always in the message table. |
| 551 SetLastError(ERROR_NOT_SUPPORTED); |
| 552 } |
548 } | 553 } |
549 return -1; | 554 return -1; |
550 } | 555 } |
551 | 556 |
552 | 557 |
553 bool File::IsAbsolutePath(const char* pathname) { | 558 bool File::IsAbsolutePath(const char* pathname) { |
554 // Should we consider network paths? | 559 // Should we consider network paths? |
555 if (pathname == NULL) { | 560 if (pathname == NULL) { |
556 return false; | 561 return false; |
557 } | 562 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 return kIdentical; | 681 return kIdentical; |
677 } else { | 682 } else { |
678 return kDifferent; | 683 return kDifferent; |
679 } | 684 } |
680 } | 685 } |
681 | 686 |
682 } // namespace bin | 687 } // namespace bin |
683 } // namespace dart | 688 } // namespace dart |
684 | 689 |
685 #endif // defined(TARGET_OS_WINDOWS) | 690 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |