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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 } | 461 } |
462 | 462 |
463 | 463 |
464 void File::Stat(const char* name, int64_t* data) { | 464 void File::Stat(const char* name, int64_t* data) { |
465 File::Type type = GetType(name, false); | 465 File::Type type = GetType(name, false); |
466 data[kType] = type; | 466 data[kType] = type; |
467 if (type != kDoesNotExist) { | 467 if (type != kDoesNotExist) { |
468 struct _stat64 st; | 468 struct _stat64 st; |
469 const wchar_t* system_name = StringUtils::Utf8ToWide(name); | 469 const wchar_t* system_name = StringUtils::Utf8ToWide(name); |
470 int stat_status = _wstat64(system_name, &st); | 470 int stat_status = _wstat64(system_name, &st); |
| 471 free(const_cast<wchar_t*>(system_name)); |
471 if (stat_status == 0) { | 472 if (stat_status == 0) { |
472 data[kCreatedTime] = st.st_ctime; | 473 data[kCreatedTime] = st.st_ctime; |
473 data[kModifiedTime] = st.st_mtime; | 474 data[kModifiedTime] = st.st_mtime; |
474 data[kAccessedTime] = st.st_atime; | 475 data[kAccessedTime] = st.st_atime; |
475 data[kMode] = st.st_mode; | 476 data[kMode] = st.st_mode; |
476 data[kSize] = st.st_size; | 477 data[kSize] = st.st_size; |
477 } else { | 478 } else { |
478 data[kType] = File::kDoesNotExist; | 479 data[kType] = File::kDoesNotExist; |
479 } | 480 } |
480 } | 481 } |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 return kIdentical; | 641 return kIdentical; |
641 } else { | 642 } else { |
642 return kDifferent; | 643 return kDifferent; |
643 } | 644 } |
644 } | 645 } |
645 | 646 |
646 } // namespace bin | 647 } // namespace bin |
647 } // namespace dart | 648 } // namespace dart |
648 | 649 |
649 #endif // defined(TARGET_OS_WINDOWS) | 650 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |