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

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

Issue 12638039: dart:io | Add "followLinks" optional parameter to Directory.list, let it return Link objects when f… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Switch from Stream.reduce to Completer in link_test. Created 7 years, 9 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 | « sdk/lib/io/directory.dart ('k') | sdk/lib/io/link.dart » ('j') | 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 a129cc788c51adb80813c00f3f2b71aa19270f5b..6b6cc38272ff92b887407bc297321441e6f59f97 100644
--- a/sdk/lib/io/directory_impl.dart
+++ b/sdk/lib/io/directory_impl.dart
@@ -26,7 +26,7 @@ class _Directory implements Directory {
external static _create(String path);
external static _delete(String path, bool recursive);
external static _rename(String path, String newPath);
- external static List _list(String path, bool recursive);
+ external static List _list(String path, bool recursive, bool followLinks);
external static SendPort _newServicePort();
Future<bool> exists() {
@@ -226,11 +226,13 @@ class _Directory implements Directory {
return new Directory(newPath);
}
- Stream<FileSystemEntity> list({bool recursive: false}) {
+ Stream<FileSystemEntity> list({bool recursive: false,
+ bool followLinks: true}) {
const int LIST_FILE = 0;
const int LIST_DIRECTORY = 1;
- const int LIST_ERROR = 2;
- const int LIST_DONE = 3;
+ const int LIST_LINK = 2;
+ const int LIST_ERROR = 3;
+ const int LIST_DONE = 4;
const int RESPONSE_TYPE = 0;
const int RESPONSE_PATH = 1;
@@ -239,7 +241,7 @@ class _Directory implements Directory {
var controller = new StreamController<FileSystemEntity>();
- List request = [ _Directory.LIST_REQUEST, path, recursive ];
+ List request = [ _Directory.LIST_REQUEST, path, recursive, followLinks ];
ReceivePort responsePort = new ReceivePort();
// Use a separate directory service port for each listing as
// listing operations on the same directory can run in parallel.
@@ -257,6 +259,9 @@ class _Directory implements Directory {
case LIST_DIRECTORY:
controller.add(new Directory(message[RESPONSE_PATH]));
break;
+ case LIST_LINK:
+ controller.add(new Link(message[RESPONSE_PATH]));
+ break;
case LIST_ERROR:
var errorType =
message[RESPONSE_ERROR][_ERROR_RESPONSE_ERROR_TYPE];
@@ -287,11 +292,11 @@ class _Directory implements Directory {
return controller.stream;
}
- List listSync({bool recursive: false}) {
+ List listSync({bool recursive: false, bool followLinks: true}) {
if (_path is! String || recursive is! bool) {
throw new ArgumentError();
}
- return _list(_path, recursive);
+ return _list(_path, recursive, followLinks);
}
String get path => _path;
« no previous file with comments | « sdk/lib/io/directory.dart ('k') | sdk/lib/io/link.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698