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

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

Issue 131373002: Fix listing of '' and '/'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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/directory_linux.cc » ('j') | sdk/lib/io/file_system_entity.dart » ('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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 LinkList* next; 72 LinkList* next;
73 }; 73 };
74 74
75 75
76 ListType DirectoryListingEntry::Next(DirectoryListing* listing) { 76 ListType DirectoryListingEntry::Next(DirectoryListing* listing) {
77 if (done_) { 77 if (done_) {
78 return kListDone; 78 return kListDone;
79 } 79 }
80 80
81 if (lister_ == 0) { 81 if (lister_ == 0) {
82 if (!listing->path_buffer().Add(File::PathSeparator())) {
83 done_ = true;
84 return kListError;
85 }
86 path_length_ = listing->path_buffer().length();
87 do { 82 do {
88 lister_ = reinterpret_cast<intptr_t>( 83 lister_ = reinterpret_cast<intptr_t>(
89 opendir(listing->path_buffer().AsString())); 84 opendir(listing->path_buffer().AsString()));
90 } while (lister_ == 0 && errno == EINTR); 85 } while (lister_ == 0 && errno == EINTR);
91 86
92 if (lister_ == 0) { 87 if (lister_ == 0) {
93 done_ = true; 88 done_ = true;
94 return kListError; 89 return kListError;
95 } 90 }
91 if (parent_ != NULL) {
92 if (!listing->path_buffer().Add(File::PathSeparator())) {
93 return kListError;
94 }
95 }
96 path_length_ = listing->path_buffer().length();
96 } 97 }
97 // Reset. 98 // Reset.
98 listing->path_buffer().Reset(path_length_); 99 listing->path_buffer().Reset(path_length_);
99 ResetLink(); 100 ResetLink();
100 101
101 // Iterate the directory and post the directories and files to the 102 // Iterate the directory and post the directories and files to the
102 // ports. 103 // ports.
103 int status = 0; 104 int status = 0;
104 dirent entry; 105 dirent entry;
105 dirent* result; 106 dirent* result;
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 bool Directory::Rename(const char* path, const char* new_path) { 446 bool Directory::Rename(const char* path, const char* new_path) {
446 ExistsResult exists = Exists(path); 447 ExistsResult exists = Exists(path);
447 if (exists != EXISTS) return false; 448 if (exists != EXISTS) return false;
448 return (TEMP_FAILURE_RETRY(rename(path, new_path)) == 0); 449 return (TEMP_FAILURE_RETRY(rename(path, new_path)) == 0);
449 } 450 }
450 451
451 } // namespace bin 452 } // namespace bin
452 } // namespace dart 453 } // namespace dart
453 454
454 #endif // defined(TARGET_OS_ANDROID) 455 #endif // defined(TARGET_OS_ANDROID)
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/directory_linux.cc » ('j') | sdk/lib/io/file_system_entity.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698