Index: sdk/lib/io/directory_impl.dart |
diff --git a/sdk/lib/io/directory_impl.dart b/sdk/lib/io/directory_impl.dart |
index 39d36cfe22c5997a49c2a49a3a76e82c56a152ec..c9eec06376a5df378adebb60dba65149c2a2bbb8 100644 |
--- a/sdk/lib/io/directory_impl.dart |
+++ b/sdk/lib/io/directory_impl.dart |
@@ -4,7 +4,7 @@ |
part of dart.io; |
-class _Directory implements Directory { |
+class _Directory extends FileSystemEntity implements Directory { |
static const CREATE_REQUEST = 0; |
static const DELETE_REQUEST = 1; |
static const EXISTS_REQUEST = 2; |
@@ -229,35 +229,22 @@ class _Directory implements Directory { |
return new Directory(newPath); |
} |
- static String _trimTrailingPathSeparators(String path) { |
- // Don't handle argument errors here. |
- if (path is! String) return path; |
- if (Platform.operatingSystem == 'windows') { |
- while (path.length > 1 && |
- (path.endsWith(Platform.pathSeparator) || |
- path.endsWith('/'))) { |
- path = path.substring(0, path.length - 1); |
- } |
- } else { |
- 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(_trimTrailingPathSeparators(path), |
- recursive, |
- followLinks).stream; |
+ return new _AsyncDirectoryLister( |
+ FileSystemEntity._trimTrailingPathSeparators(path), |
+ recursive, |
+ followLinks).stream; |
} |
List listSync({bool recursive: false, bool followLinks: true}) { |
if (recursive is! bool || followLinks is! bool) { |
throw new ArgumentError(); |
} |
- return _list(_trimTrailingPathSeparators(path), recursive, followLinks); |
+ return _list( |
+ FileSystemEntity._trimTrailingPathSeparators(path), |
+ recursive, |
+ followLinks); |
} |
String toString() => "Directory: '$path'"; |