Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: runtime/bin/file_win.cc

Issue 16140008: dart:io | Make FileStat.stat throw an exception when the file does not exist, or cannot be accessed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/file_macos.cc ('k') | tests/standalone/io/file_stat_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) { 394 void File::Stat(const char* name, int64_t* data) {
395 File::Type type = GetType(name, false); 395 File::Type type = GetType(name, false);
396 data[kType] = type; 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) { 397 if (type != kDoesNotExist) {
403 struct _stat64 st; 398 struct _stat64 st;
404 const wchar_t* system_name = StringUtils::Utf8ToWide(name); 399 const wchar_t* system_name = StringUtils::Utf8ToWide(name);
405 int stat_status = _wstat64(system_name, &st); 400 int stat_status = _wstat64(system_name, &st);
406 if (stat_status == 0) { 401 if (stat_status == 0) {
407 data[kCreatedTime] = st.st_ctime; 402 data[kCreatedTime] = st.st_ctime;
408 data[kModifiedTime] = st.st_mtime; 403 data[kModifiedTime] = st.st_mtime;
409 data[kAccessedTime] = st.st_atime; 404 data[kAccessedTime] = st.st_atime;
410 data[kMode] = st.st_mode; 405 data[kMode] = st.st_mode;
411 data[kSize] = st.st_size; 406 data[kSize] = st.st_size;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 return kIdentical; 540 return kIdentical;
546 } else { 541 } else {
547 return kDifferent; 542 return kDifferent;
548 } 543 }
549 } 544 }
550 545
551 } // namespace bin 546 } // namespace bin
552 } // namespace dart 547 } // namespace dart
553 548
554 #endif // defined(TARGET_OS_WINDOWS) 549 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « runtime/bin/file_macos.cc ('k') | tests/standalone/io/file_stat_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698