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

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

Issue 15832003: Change File.directory to not do any IO (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.cc ('k') | runtime/bin/file_linux.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_ANDROID) 6 #if defined(TARGET_OS_ANDROID)
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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 } while (abs_path == NULL && errno == EINTR); 274 } while (abs_path == NULL && errno == EINTR);
275 ASSERT(abs_path == NULL || IsAbsolutePath(abs_path)); 275 ASSERT(abs_path == NULL || IsAbsolutePath(abs_path));
276 if (abs_path != resolved) { 276 if (abs_path != resolved) {
277 free(resolved); 277 free(resolved);
278 } 278 }
279 } 279 }
280 return abs_path; 280 return abs_path;
281 } 281 }
282 282
283 283
284 char* File::GetContainingDirectory(char* pathname) {
285 // Report errors for non-regular files.
286 struct stat st;
287 if (TEMP_FAILURE_RETRY(stat(pathname, &st)) == 0) {
288 if (!S_ISREG(st.st_mode)) {
289 errno = (S_ISDIR(st.st_mode)) ? EISDIR : ENOENT;
290 return NULL;
291 }
292 } else {
293 return NULL;
294 }
295 char* path = NULL;
296 do {
297 path = dirname(pathname);
298 } while (path == NULL && errno == EINTR);
299 return GetCanonicalPath(path);
300 }
301
302
303 const char* File::PathSeparator() { 284 const char* File::PathSeparator() {
304 return "/"; 285 return "/";
305 } 286 }
306 287
307 288
308 const char* File::StringEscapedPathSeparator() { 289 const char* File::StringEscapedPathSeparator() {
309 return "/"; 290 return "/";
310 } 291 }
311 292
312 293
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 return (file_1_info.st_ino == file_2_info.st_ino && 332 return (file_1_info.st_ino == file_2_info.st_ino &&
352 file_1_info.st_dev == file_2_info.st_dev) ? 333 file_1_info.st_dev == file_2_info.st_dev) ?
353 File::kIdentical : 334 File::kIdentical :
354 File::kDifferent; 335 File::kDifferent;
355 } 336 }
356 337
357 } // namespace bin 338 } // namespace bin
358 } // namespace dart 339 } // namespace dart
359 340
360 #endif // defined(TARGET_OS_ANDROID) 341 #endif // defined(TARGET_OS_ANDROID)
OLDNEW
« no previous file with comments | « runtime/bin/file.cc ('k') | runtime/bin/file_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698