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

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

Issue 12316036: Merge IO v2 branch to bleeding edge (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased to r18818 Created 7 years, 10 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/chunked_stream.dart ('k') | sdk/lib/io/directory_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/directory.dart
diff --git a/sdk/lib/io/directory.dart b/sdk/lib/io/directory.dart
index 60717b86e7192028c459c3dc31b551352d4a6133..ebe1353b84039131ace20e53864cb289d3e3b699 100644
--- a/sdk/lib/io/directory.dart
+++ b/sdk/lib/io/directory.dart
@@ -7,7 +7,7 @@ part of dart.io;
/**
* [Directory] objects are used for working with directories.
*/
-abstract class Directory {
+abstract class Directory extends FileSystemEntity {
/**
* Creates a directory object. The path is either an absolute path,
* or it is a relative path which is interpreted relative to the directory
@@ -131,20 +131,22 @@ abstract class Directory {
Directory renameSync(String newPath);
/**
- * List the sub-directories and files of this
- * [Directory]. Optionally recurse into sub-directories. Returns a
- * [DirectoryLister] object representing the active listing
- * operation. Handlers for files and directories should be
- * registered on this DirectoryLister object.
+ * List the sub-directories and files of this [Directory].
+ * Optionally recurse into sub-directories.
+ *
+ * The result is a stream of [FileSystemEntity] objects
+ * for the directories and files.
*/
- DirectoryLister list({bool recursive: false});
+ Stream<FileSystemEntity> list({bool recursive: false});
/**
- * List the sub-directories and files of this
- * [Directory]. Optionally recurse into sub-directories. Returns a
- * List containing Directory and File objects.
+ * List the sub-directories and files of this [Directory].
+ * Optionally recurse into sub-directories.
+ *
+ * Returns a [List] containing [FileSystemEntity] objects for the
+ * directories and files.
*/
- List listSync({bool recursive: false});
+ List<FileSystemEntity> listSync({bool recursive: false});
/**
* Returns a human readable string for this Directory instance.
@@ -158,49 +160,6 @@ abstract class Directory {
}
-/**
- * A [DirectoryLister] represents an actively running listing operation.
- *
- * A [DirectoryLister] is obtained from a [Directory] object by calling
- * the [:Directory.list:] method.
- *
- * Directory dir = new Directory('path/to/my/dir');
- * DirectoryLister lister = dir.list();
- *
- * For each file and directory, the file or directory handler is
- * called. When all directories have been listed the done handler is
- * called. If the listing operation is recursive, the error handler is
- * called if a subdirectory cannot be opened for listing.
- */
-abstract class DirectoryLister {
- /**
- * Sets the directory handler that is called for all directories
- * during listing. The directory handler is called with the full
- * path of the directory.
- */
- void set onDir(void onDir(String dir));
-
- /**
- * Sets the handler that is called for all files during listing. The
- * file handler is called with the full path of the file.
- */
- void set onFile(void onFile(String file));
-
- /**
- * Set the handler that is called when a listing is done. The
- * handler is called with an indication of whether or not the
- * listing operation completed.
- */
- void set onDone(void onDone(bool completed));
-
- /**
- * Sets the handler that is called if there is an error while
- * listing directories.
- */
- void set onError(void onError(e));
-}
-
-
class DirectoryIOException implements Exception {
const DirectoryIOException([String this.message = "",
String this.path = "",
« no previous file with comments | « sdk/lib/io/chunked_stream.dart ('k') | sdk/lib/io/directory_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698