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

Unified Diff: runtime/bin/directory.dart

Issue 8965036: Add asynchronous versions of the methods on Directory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 9 years 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 | « runtime/bin/directory.cc ('k') | runtime/bin/directory_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/directory.dart
diff --git a/runtime/bin/directory.dart b/runtime/bin/directory.dart
index acdcd09444312e0f95e231102ee08d697700ee9c..deafdc24c93cbbfcdd49dbb89ab01399229d4a67 100644
--- a/runtime/bin/directory.dart
+++ b/runtime/bin/directory.dart
@@ -11,13 +11,27 @@ interface Directory factory _Directory {
Directory(String path);
/**
- * Returns whether a directory with this name already exists.
+ * Check whether a directory with this name already exists. If the
+ * operation completes successfully the [existsHandler] is called with
+ * the result. Otherwise the [errorHandler] is called.
+ */
+ void exists();
+
+ /**
+ * Synchronously check whether a directory with this name already exists.
*/
bool existsSync();
/**
* Creates the directory with this name if it does not exist.
- * Throw an exception if the directory already exists.
+ * If the directory is successfully created the [createHandler] is
+ * called. Otherwise the [errorHandler] is called.
+ */
+ void create();
+
+ /**
+ * Synchronously creates the directory with this name if it does not exist.
+ * Throws an exception if the directory already exists.
*/
void createSync();
@@ -35,16 +49,23 @@ interface Directory factory _Directory {
void createTemp();
/**
- * Synchronously creates a temporary directory with a name based on the current path.
- * This name and path is used as a template, and additional characters are
- * appended to it by the call to make a unique directory name. If the
- * path is the empty string, a default system temp directory and name
+ * Synchronously creates a temporary directory with a name based on the
+ * current path. This name and path is used as a template, and additional
+ * characters are appended to it by the call to make a unique directory name.
+ * If the path is the empty string, a default system temp directory and name
* are used for the template.
* The path is modified to be the path of the new directory.
*/
void createTempSync();
/**
+ * Deletes the directory with this name. If the operation completes
+ * successfully the [deleteHandler] is called. Otherwise the
+ * [errorHandler] is called.
+ */
+ void delete();
+
+ /**
* Deletes the directory with this name. Throws an exception
* if the directory is not empty or if deletion failed.
*/
@@ -82,12 +103,29 @@ interface Directory factory _Directory {
void set doneHandler(void doneHandler(bool completed));
/**
+ * Set the handler that is called when checking if a directory with this
+ * name exists.
+ */
+ void set existsHandler(void existsHandler(bool exists));
+
+ /**
+ * Set the handler that is called when a directory is successfully created.
+ */
+ void set createHandler(void createHandler());
+
+ /**
* Set the handler that is called when a temporary directory is
* successfully created.
*/
void set createTempHandler(void doneHandler(bool completed));
/**
+ * Set the handler that is called when a directory is successfully
+ * deleted.
+ */
+ void set deleteHandler(void deleteHandler());
+
+ /**
* Sets the handler that is called if there is an error while listing
* or creating directories.
*/
« no previous file with comments | « runtime/bin/directory.cc ('k') | runtime/bin/directory_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698