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 dir); | 11 Directory(String path); |
| 12 |
| 13 /** |
| 14 * Returns whether a directory with this name already exists. |
| 15 */ |
| 16 bool exists(); |
| 17 |
| 18 /** |
| 19 * Creates the directory with this name if it does not exist. |
| 20 * Throw an exception if the directory already exists. |
| 21 */ |
| 22 void create(); |
| 23 |
| 24 /** |
| 25 * Deletes the directory with this name. Throws an exception |
| 26 * if the directory is not empty or if deletion failed. |
| 27 */ |
| 28 void delete(); |
12 | 29 |
13 /** | 30 /** |
14 * List the sub-directories and files of this | 31 * List the sub-directories and files of this |
15 * [Directory]. Optionally recurse into sub-directories. For each | 32 * [Directory]. Optionally recurse into sub-directories. For each |
16 * file and directory, the file or directory handler is called. When | 33 * file and directory, the file or directory handler is called. When |
17 * all directories have been listed the done handler is called. If | 34 * all directories have been listed the done handler is called. If |
18 * the listing operation is recursive, the error handler is called | 35 * the listing operation is recursive, the error handler is called |
19 * if a subdirectory cannot be opened for listing. | 36 * if a subdirectory cannot be opened for listing. |
20 */ | 37 */ |
21 void list([bool recursive]); | 38 void list([bool recursive]); |
(...skipping 17 matching lines...) Expand all Loading... |
39 * 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 |
40 * the listing operation completed. | 57 * the listing operation completed. |
41 */ | 58 */ |
42 void setDoneHandler(void doneHandler(bool completed)); | 59 void setDoneHandler(void doneHandler(bool completed)); |
43 | 60 |
44 /** | 61 /** |
45 * Sets the error handler that is called on errors listing | 62 * Sets the error handler that is called on errors listing |
46 * directories. | 63 * directories. |
47 */ | 64 */ |
48 void setErrorHandler(void errorHandler(String error)); | 65 void setErrorHandler(void errorHandler(String error)); |
| 66 |
| 67 /** |
| 68 * Gets the path of this directory. |
| 69 */ |
| 70 final String path; |
49 } | 71 } |
OLD | NEW |