Chromium Code Reviews| 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; |