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

Side by Side Diff: runtime/bin/file_macos.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_linux.cc ('k') | runtime/bin/file_win.cc » ('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_MACOS) 6 #if defined(TARGET_OS_MACOS)
7 7
8 #include "bin/file.h" 8 #include "bin/file.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } else { 216 } else {
217 data[kType] = kDoesNotExist; 217 data[kType] = kDoesNotExist;
218 } 218 }
219 data[kCreatedTime] = st.st_ctime; 219 data[kCreatedTime] = st.st_ctime;
220 data[kModifiedTime] = st.st_mtime; 220 data[kModifiedTime] = st.st_mtime;
221 data[kAccessedTime] = st.st_atime; 221 data[kAccessedTime] = st.st_atime;
222 data[kMode] = st.st_mode; 222 data[kMode] = st.st_mode;
223 data[kSize] = st.st_size; 223 data[kSize] = st.st_size;
224 } else { 224 } else {
225 data[kType] = kDoesNotExist; 225 data[kType] = kDoesNotExist;
226 data[kCreatedTime] = 0;
227 data[kModifiedTime] = 0;
228 data[kAccessedTime] = 0;
229 data[kMode] = 0;
230 data[kSize] = 0;
231 } 226 }
232 } 227 }
233 228
234 229
235 time_t File::LastModified(const char* name) { 230 time_t File::LastModified(const char* name) {
236 struct stat st; 231 struct stat st;
237 if (TEMP_FAILURE_RETRY(stat(name, &st)) == 0) { 232 if (TEMP_FAILURE_RETRY(stat(name, &st)) == 0) {
238 return st.st_mtime; 233 return st.st_mtime;
239 } 234 }
240 return -1; 235 return -1;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 return (file_1_info.st_ino == file_2_info.st_ino && 329 return (file_1_info.st_ino == file_2_info.st_ino &&
335 file_1_info.st_dev == file_2_info.st_dev) ? 330 file_1_info.st_dev == file_2_info.st_dev) ?
336 File::kIdentical : 331 File::kIdentical :
337 File::kDifferent; 332 File::kDifferent;
338 } 333 }
339 334
340 } // namespace bin 335 } // namespace bin
341 } // namespace dart 336 } // namespace dart
342 337
343 #endif // defined(TARGET_OS_MACOS) 338 #endif // defined(TARGET_OS_MACOS)
OLDNEW
« no previous file with comments | « runtime/bin/file_linux.cc ('k') | runtime/bin/file_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698