| 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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 free(buffer); | 454 free(buffer); |
| 455 free(utf8_target); | 455 free(utf8_target); |
| 456 return NULL; | 456 return NULL; |
| 457 } | 457 } |
| 458 utf8_target[utf8_length] = '\0'; | 458 utf8_target[utf8_length] = '\0'; |
| 459 free(buffer); | 459 free(buffer); |
| 460 return utf8_target; | 460 return utf8_target; |
| 461 } | 461 } |
| 462 | 462 |
| 463 | 463 |
| 464 static int64_t TimespecToMilliseconds(const struct timespec& t) { | |
| 465 return t.tv_sec * 1000 + t.tv_nsec / 1000000; | |
| 466 } | |
| 467 | |
| 468 | |
| 469 void File::Stat(const char* name, int64_t* data) { | 464 void File::Stat(const char* name, int64_t* data) { |
| 470 File::Type type = GetType(name, false); | 465 File::Type type = GetType(name, false); |
| 471 data[kType] = type; | 466 data[kType] = type; |
| 472 if (type != kDoesNotExist) { | 467 if (type != kDoesNotExist) { |
| 473 struct _stat64 st; | 468 struct _stat64 st; |
| 474 const wchar_t* system_name = StringUtils::Utf8ToWide(name); | 469 const wchar_t* system_name = StringUtils::Utf8ToWide(name); |
| 475 int stat_status = _wstat64(system_name, &st); | 470 int stat_status = _wstat64(system_name, &st); |
| 476 free(const_cast<wchar_t*>(system_name)); | 471 free(const_cast<wchar_t*>(system_name)); |
| 477 if (stat_status == 0) { | 472 if (stat_status == 0) { |
| 478 data[kCreatedTime] = st.st_ctime * 1000; | 473 data[kCreatedTime] = st.st_ctime * 1000; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 return kIdentical; | 641 return kIdentical; |
| 647 } else { | 642 } else { |
| 648 return kDifferent; | 643 return kDifferent; |
| 649 } | 644 } |
| 650 } | 645 } |
| 651 | 646 |
| 652 } // namespace bin | 647 } // namespace bin |
| 653 } // namespace dart | 648 } // namespace dart |
| 654 | 649 |
| 655 #endif // defined(TARGET_OS_WINDOWS) | 650 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |