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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 } | 448 } |
449 | 449 |
450 | 450 |
451 void File::Stat(const char* name, int64_t* data) { | 451 void File::Stat(const char* name, int64_t* data) { |
452 File::Type type = GetType(name, false); | 452 File::Type type = GetType(name, false); |
453 data[kType] = type; | 453 data[kType] = type; |
454 if (type != kDoesNotExist) { | 454 if (type != kDoesNotExist) { |
455 struct _stat64 st; | 455 struct _stat64 st; |
456 const wchar_t* system_name = StringUtils::Utf8ToWide(name); | 456 const wchar_t* system_name = StringUtils::Utf8ToWide(name); |
457 int stat_status = _wstat64(system_name, &st); | 457 int stat_status = _wstat64(system_name, &st); |
| 458 free(const_cast<wchar_t*>(system_name)); |
458 if (stat_status == 0) { | 459 if (stat_status == 0) { |
459 data[kCreatedTime] = st.st_ctime; | 460 data[kCreatedTime] = st.st_ctime; |
460 data[kModifiedTime] = st.st_mtime; | 461 data[kModifiedTime] = st.st_mtime; |
461 data[kAccessedTime] = st.st_atime; | 462 data[kAccessedTime] = st.st_atime; |
462 data[kMode] = st.st_mode; | 463 data[kMode] = st.st_mode; |
463 data[kSize] = st.st_size; | 464 data[kSize] = st.st_size; |
464 } else { | 465 } else { |
465 data[kType] = File::kDoesNotExist; | 466 data[kType] = File::kDoesNotExist; |
466 } | 467 } |
467 } | 468 } |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 return kIdentical; | 628 return kIdentical; |
628 } else { | 629 } else { |
629 return kDifferent; | 630 return kDifferent; |
630 } | 631 } |
631 } | 632 } |
632 | 633 |
633 } // namespace bin | 634 } // namespace bin |
634 } // namespace dart | 635 } // namespace dart |
635 | 636 |
636 #endif // defined(TARGET_OS_WINDOWS) | 637 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |