| 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 } | 437 } |
| 438 return false; | 438 return false; |
| 439 } | 439 } |
| 440 | 440 |
| 441 | 441 |
| 442 int64_t File::LengthFromPath(const char* name) { | 442 int64_t File::LengthFromPath(const char* name) { |
| 443 struct __stat64 st; | 443 struct __stat64 st; |
| 444 Utf8ToWideScope system_name(name); | 444 Utf8ToWideScope system_name(name); |
| 445 int stat_status = _wstat64(system_name.wide(), &st); | 445 int stat_status = _wstat64(system_name.wide(), &st); |
| 446 if (stat_status == 0) { | 446 if (stat_status == 0) { |
| 447 return st.st_size; | 447 if ((st.st_mode & S_IFMT) == S_IFREG) { |
| 448 return st.st_size; |
| 449 } else { |
| 450 // ERROR_DIRECTORY_NOT_SUPPORTED is not always in the message table. |
| 451 SetLastError(ERROR_NOT_SUPPORTED); |
| 452 } |
| 448 } | 453 } |
| 449 return -1; | 454 return -1; |
| 450 } | 455 } |
| 451 | 456 |
| 452 | 457 |
| 453 const char* File::LinkTarget(const char* pathname) { | 458 const char* File::LinkTarget(const char* pathname) { |
| 454 const wchar_t* name = StringUtilsWin::Utf8ToWide(pathname); | 459 const wchar_t* name = StringUtilsWin::Utf8ToWide(pathname); |
| 455 HANDLE dir_handle = CreateFileW( | 460 HANDLE dir_handle = CreateFileW( |
| 456 name, GENERIC_READ, | 461 name, GENERIC_READ, |
| 457 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, | 462 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 return kIdentical; | 676 return kIdentical; |
| 672 } else { | 677 } else { |
| 673 return kDifferent; | 678 return kDifferent; |
| 674 } | 679 } |
| 675 } | 680 } |
| 676 | 681 |
| 677 } // namespace bin | 682 } // namespace bin |
| 678 } // namespace dart | 683 } // namespace dart |
| 679 | 684 |
| 680 #endif // defined(TARGET_OS_WINDOWS) | 685 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |