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

Side by Side Diff: runtime/bin/file_linux.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_android.cc ('k') | runtime/bin/file_macos.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_LINUX) 6 #if defined(TARGET_OS_LINUX)
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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } else { 214 } else {
215 data[kType] = kDoesNotExist; 215 data[kType] = kDoesNotExist;
216 } 216 }
217 data[kCreatedTime] = st.st_ctime; 217 data[kCreatedTime] = st.st_ctime;
218 data[kModifiedTime] = st.st_mtime; 218 data[kModifiedTime] = st.st_mtime;
219 data[kAccessedTime] = st.st_atime; 219 data[kAccessedTime] = st.st_atime;
220 data[kMode] = st.st_mode; 220 data[kMode] = st.st_mode;
221 data[kSize] = st.st_size; 221 data[kSize] = st.st_size;
222 } else { 222 } else {
223 data[kType] = kDoesNotExist; 223 data[kType] = kDoesNotExist;
224 data[kCreatedTime] = 0;
225 data[kModifiedTime] = 0;
226 data[kAccessedTime] = 0;
227 data[kMode] = 0;
228 data[kSize] = 0;
229 } 224 }
230 } 225 }
231 226
232 227
233 time_t File::LastModified(const char* name) { 228 time_t File::LastModified(const char* name) {
234 struct stat st; 229 struct stat st;
235 if (TEMP_FAILURE_RETRY(stat(name, &st)) == 0) { 230 if (TEMP_FAILURE_RETRY(stat(name, &st)) == 0) {
236 return st.st_mtime; 231 return st.st_mtime;
237 } 232 }
238 return -1; 233 return -1;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 return (file_1_info.st_ino == file_2_info.st_ino && 321 return (file_1_info.st_ino == file_2_info.st_ino &&
327 file_1_info.st_dev == file_2_info.st_dev) ? 322 file_1_info.st_dev == file_2_info.st_dev) ?
328 File::kIdentical : 323 File::kIdentical :
329 File::kDifferent; 324 File::kDifferent;
330 } 325 }
331 326
332 } // namespace bin 327 } // namespace bin
333 } // namespace dart 328 } // namespace dart
334 329
335 #endif // defined(TARGET_OS_LINUX) 330 #endif // defined(TARGET_OS_LINUX)
OLDNEW
« no previous file with comments | « runtime/bin/file_android.cc ('k') | runtime/bin/file_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698