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

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

Issue 15894004: dart:io | Fix a few bugs in the Android port of dart: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 | « no previous file | runtime/bin/file_android.cc » ('j') | runtime/bin/file_android.cc » ('J')
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/directory.h" 8 #include "bin/directory.h"
9 9
10 #include <dirent.h> // NOLINT 10 #include <dirent.h> // NOLINT
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 // suitable for bring-up work and tests, is to create a tmp 471 // suitable for bring-up work and tests, is to create a tmp
472 // directory in /data/local/tmp. 472 // directory in /data/local/tmp.
473 // 473 //
474 // TODO(4413): In the long run, when running in an application we should 474 // TODO(4413): In the long run, when running in an application we should
475 // probably use android.content.Context.getCacheDir(). 475 // probably use android.content.Context.getCacheDir().
476 #define ANDROID_TEMP_DIR "/data/local/tmp" 476 #define ANDROID_TEMP_DIR "/data/local/tmp"
477 struct stat st; 477 struct stat st;
478 if (stat(ANDROID_TEMP_DIR, &st) != 0) { 478 if (stat(ANDROID_TEMP_DIR, &st) != 0) {
479 mkdir(ANDROID_TEMP_DIR, 0777); 479 mkdir(ANDROID_TEMP_DIR, 0777);
480 } 480 }
481 path.Add(ANDROID_TEMP_DIR "/tmp/temp_dir1_"); 481 path.Add(ANDROID_TEMP_DIR "/temp_dir1_");
482 } else if ((path.data)[path.length - 1] == '/') { 482 } else if ((path.data)[path.length - 1] == '/') {
483 path.Add("temp_dir_"); 483 path.Add("temp_dir_");
484 } 484 }
485 if (!path.Add("XXXXXX")) { 485 if (!path.Add("XXXXXX")) {
486 // Pattern has overflowed. 486 // Pattern has overflowed.
487 return NULL; 487 return NULL;
488 } 488 }
489 char* result; 489 char* result;
490 do { 490 do {
491 result = MakeTempDirectory(path.data); 491 result = MakeTempDirectory(path.data);
(...skipping 29 matching lines...) Expand all
521 bool Directory::Rename(const char* path, const char* new_path) { 521 bool Directory::Rename(const char* path, const char* new_path) {
522 ExistsResult exists = Exists(path); 522 ExistsResult exists = Exists(path);
523 if (exists != EXISTS) return false; 523 if (exists != EXISTS) return false;
524 return (TEMP_FAILURE_RETRY(rename(path, new_path)) == 0); 524 return (TEMP_FAILURE_RETRY(rename(path, new_path)) == 0);
525 } 525 }
526 526
527 } // namespace bin 527 } // namespace bin
528 } // namespace dart 528 } // namespace dart
529 529
530 #endif // defined(TARGET_OS_ANDROID) 530 #endif // defined(TARGET_OS_ANDROID)
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/file_android.cc » ('j') | runtime/bin/file_android.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698