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

Unified Diff: sdk/lib/io/directory_impl.dart

Issue 17265003: Avoid double-// on directory listing. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/directory_impl.dart
diff --git a/sdk/lib/io/directory_impl.dart b/sdk/lib/io/directory_impl.dart
index f47ef4f90a7a1c5ff441597ba5b783cb9a81383a..5cdcdbb482dcf09cca76979fce3fa5b521e426af 100644
--- a/sdk/lib/io/directory_impl.dart
+++ b/sdk/lib/io/directory_impl.dart
@@ -237,16 +237,25 @@ class _Directory implements Directory {
return new Directory(newPath);
}
+ static String _getListPath(String path) {
Søren Gjesse 2013/06/17 15:01:55 _removeTrailingPathSeparators?
+ while (path.length > 1 && path.endsWith(Platform.pathSeparator)) {
+ path = path.substring(0, path.length - 1);
+ }
+ return path;
+ }
+
Stream<FileSystemEntity> list({bool recursive: false,
bool followLinks: true}) {
- return new _AsyncDirectoryLister(path, recursive, followLinks).stream;
+ return new _AsyncDirectoryLister(_getListPath(path),
+ recursive,
+ followLinks).stream;
}
List listSync({bool recursive: false, bool followLinks: true}) {
- if (_path is! String || recursive is! bool) {
+ if (recursive is! bool || followLinks is! bool) {
throw new ArgumentError();
}
- return _list(_path, recursive, followLinks);
+ return _list(_getListPath(path), recursive, followLinks);
}
String get path => _path;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698