| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 interface Directory factory _Directory { | 5 interface Directory factory _Directory { |
| 6 /** | 6 /** |
| 7 * Creates a directory object. The path is either a full path or | 7 * Creates a directory object. The path is either a full path or |
| 8 * relative to the directory in which the Dart VM was | 8 * relative to the directory in which the Dart VM was |
| 9 * started. | 9 * started. |
| 10 */ | 10 */ |
| 11 Directory(String path); | 11 Directory(String path); |
| 12 | 12 |
| 13 /** | 13 /** |
| 14 * Returns whether a directory with this name already exists. | 14 * Returns whether a directory with this name already exists. |
| 15 */ | 15 */ |
| 16 bool exists(); | 16 bool existsSync(); |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * Creates the directory with this name if it does not exist. | 19 * Creates the directory with this name if it does not exist. |
| 20 * Throw an exception if the directory already exists. | 20 * Throw an exception if the directory already exists. |
| 21 */ | 21 */ |
| 22 void create(); | 22 void createSync(); |
| 23 | 23 |
| 24 /** | 24 /** |
| 25 * Deletes the directory with this name. Throws an exception | 25 * Deletes the directory with this name. Throws an exception |
| 26 * if the directory is not empty or if deletion failed. | 26 * if the directory is not empty or if deletion failed. |
| 27 */ | 27 */ |
| 28 void delete(); | 28 void deleteSync(); |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * List the sub-directories and files of this | 31 * List the sub-directories and files of this |
| 32 * [Directory]. Optionally recurse into sub-directories. For each | 32 * [Directory]. Optionally recurse into sub-directories. For each |
| 33 * file and directory, the file or directory handler is called. When | 33 * file and directory, the file or directory handler is called. When |
| 34 * all directories have been listed the done handler is called. If | 34 * all directories have been listed the done handler is called. If |
| 35 * the listing operation is recursive, the error handler is called | 35 * the listing operation is recursive, the error handler is called |
| 36 * if a subdirectory cannot be opened for listing. | 36 * if a subdirectory cannot be opened for listing. |
| 37 */ | 37 */ |
| 38 void list([bool recursive]); | 38 void list([bool recursive]); |
| 39 | 39 |
| 40 /** | 40 /** |
| 41 * Sets the directory handler that is called for all directories | 41 * Sets the directory handler that is called for all directories |
| 42 * during listing operations. The directory handler is called with | 42 * during listing operations. The directory handler is called with |
| 43 * the full path of the directory. | 43 * the full path of the directory. |
| 44 */ | 44 */ |
| 45 void setDirHandler(void dirHandler(String dir)); | 45 void set dirHandler(void dirHandler(String dir)); |
| 46 | 46 |
| 47 /** | 47 /** |
| 48 * Sets the file handler that is called for all files during listing | 48 * Sets the file handler that is called for all files during listing |
| 49 * operations. The file handler is called with the full path of the | 49 * operations. The file handler is called with the full path of the |
| 50 * file. | 50 * file. |
| 51 */ | 51 */ |
| 52 void setFileHandler(void fileHandler(String file)); | 52 void set fileHandler(void fileHandler(String file)); |
| 53 | 53 |
| 54 /** | 54 /** |
| 55 * Set the done handler that is called when a directory listing is | 55 * Set the done handler that is called when a directory listing is |
| 56 * done. The handler is called with an indication of whether or not | 56 * done. The handler is called with an indication of whether or not |
| 57 * the listing operation completed. | 57 * the listing operation completed. |
| 58 */ | 58 */ |
| 59 void setDoneHandler(void doneHandler(bool completed)); | 59 void set doneHandler(void doneHandler(bool completed)); |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * Sets the error handler that is called on error listing | 62 * Sets the error handler that is called on error listing |
| 63 * directories. | 63 * directories. |
| 64 */ | 64 */ |
| 65 void setErrorHandler(void errorHandler(String error)); | 65 void set errorHandler(void errorHandler(String error)); |
| 66 | 66 |
| 67 /** | 67 /** |
| 68 * Gets the path of this directory. | 68 * Gets the path of this directory. |
| 69 */ | 69 */ |
| 70 final String path; | 70 final String path; |
| 71 } | 71 } |
| 72 | 72 |
| 73 | 73 |
| 74 class DirectoryException { | 74 class DirectoryException { |
| 75 const DirectoryException(String this.message); | 75 const DirectoryException(String this.message); |
| 76 String toString() => "DirectoryException: $message"; | 76 String toString() => "DirectoryException: $message"; |
| 77 final String message; | 77 final String message; |
| 78 } | 78 } |
| OLD | NEW |