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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 free(buffer); | 384 free(buffer); |
385 free(utf8_target); | 385 free(utf8_target); |
386 return NULL; | 386 return NULL; |
387 } | 387 } |
388 utf8_target[utf8_length] = '\0'; | 388 utf8_target[utf8_length] = '\0'; |
389 free(buffer); | 389 free(buffer); |
390 return utf8_target; | 390 return utf8_target; |
391 } | 391 } |
392 | 392 |
393 | 393 |
| 394 void File::Stat(const char* name, int64_t* data) { |
| 395 File::Type type = GetType(name, false); |
| 396 data[kType] = type; |
| 397 data[kCreatedTime] = 0; |
| 398 data[kModifiedTime] = 0; |
| 399 data[kAccessedTime] = 0; |
| 400 data[kMode] = 0; |
| 401 data[kSize] = 0; |
| 402 if (type != kDoesNotExist) { |
| 403 struct _stat64 st; |
| 404 const wchar_t* system_name = StringUtils::Utf8ToWide(name); |
| 405 int stat_status = _wstat64(system_name, &st); |
| 406 if (stat_status == 0) { |
| 407 data[kCreatedTime] = st.st_ctime; |
| 408 data[kModifiedTime] = st.st_mtime; |
| 409 data[kAccessedTime] = st.st_atime; |
| 410 data[kMode] = st.st_mode; |
| 411 data[kSize] = st.st_size; |
| 412 } else { |
| 413 data[kType] = File::kDoesNotExist; |
| 414 } |
| 415 } |
| 416 } |
| 417 |
| 418 |
394 time_t File::LastModified(const char* name) { | 419 time_t File::LastModified(const char* name) { |
395 struct _stat st; | 420 struct _stat st; |
396 const wchar_t* system_name = StringUtils::Utf8ToWide(name); | 421 const wchar_t* system_name = StringUtils::Utf8ToWide(name); |
397 int stat_status = _wstat(system_name, &st); | 422 int stat_status = _wstat(system_name, &st); |
398 free(const_cast<wchar_t*>(system_name)); | 423 free(const_cast<wchar_t*>(system_name)); |
399 if (stat_status == 0) { | 424 if (stat_status == 0) { |
400 return st.st_mtime; | 425 return st.st_mtime; |
401 } | 426 } |
402 return -1; | 427 return -1; |
403 } | 428 } |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 return kIdentical; | 578 return kIdentical; |
554 } else { | 579 } else { |
555 return kDifferent; | 580 return kDifferent; |
556 } | 581 } |
557 } | 582 } |
558 | 583 |
559 } // namespace bin | 584 } // namespace bin |
560 } // namespace dart | 585 } // namespace dart |
561 | 586 |
562 #endif // defined(TARGET_OS_WINDOWS) | 587 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |