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

Side by Side Diff: sdk/lib/io/directory_impl.dart

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
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 part of dart.io; 5 part of dart.io;
6 6
7 class _Directory extends FileSystemEntity implements Directory { 7 class _Directory extends FileSystemEntity implements Directory {
8 final String path; 8 final String path;
9 9
10 _Directory(this.path) { 10 _Directory(this.path) {
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 var result = _rename(path, newPath); 206 var result = _rename(path, newPath);
207 if (result is OSError) { 207 if (result is OSError) {
208 throw new FileSystemException("Rename failed", path, result); 208 throw new FileSystemException("Rename failed", path, result);
209 } 209 }
210 return new Directory(newPath); 210 return new Directory(newPath);
211 } 211 }
212 212
213 Stream<FileSystemEntity> list({bool recursive: false, 213 Stream<FileSystemEntity> list({bool recursive: false,
214 bool followLinks: true}) { 214 bool followLinks: true}) {
215 return new _AsyncDirectoryLister( 215 return new _AsyncDirectoryLister(
216 FileSystemEntity._trimTrailingPathSeparators(path), 216 FileSystemEntity._ensureTrailingPathSeparators(path),
217 recursive, 217 recursive,
218 followLinks).stream; 218 followLinks).stream;
219 } 219 }
220 220
221 List listSync({bool recursive: false, bool followLinks: true}) { 221 List listSync({bool recursive: false, bool followLinks: true}) {
222 if (recursive is! bool || followLinks is! bool) { 222 if (recursive is! bool || followLinks is! bool) {
223 throw new ArgumentError(); 223 throw new ArgumentError();
224 } 224 }
225 return _list( 225 return _list(
226 FileSystemEntity._trimTrailingPathSeparators(path), 226 FileSystemEntity._ensureTrailingPathSeparators(path),
227 recursive, 227 recursive,
228 followLinks); 228 followLinks);
229 } 229 }
230 230
231 String toString() => "Directory: '$path'"; 231 String toString() => "Directory: '$path'";
232 232
233 bool _isErrorResponse(response) => 233 bool _isErrorResponse(response) =>
234 response is List && response[0] != _SUCCESS_RESPONSE; 234 response is List && response[0] != _SUCCESS_RESPONSE;
235 235
236 _exceptionOrErrorFromResponse(response, String message) { 236 _exceptionOrErrorFromResponse(response, String message) {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 controller.addError( 377 controller.addError(
378 new FileSystemException("Directory listing failed", 378 new FileSystemException("Directory listing failed",
379 errorPath, 379 errorPath,
380 err)); 380 err));
381 } else { 381 } else {
382 controller.addError( 382 controller.addError(
383 new FileSystemException("Internal error")); 383 new FileSystemException("Internal error"));
384 } 384 }
385 } 385 }
386 } 386 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698