OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
6 * [Directory] objects are used for working with directories. | 6 * [Directory] objects are used for working with directories. |
7 */ | 7 */ |
8 interface Directory default _Directory { | 8 interface Directory default _Directory { |
9 /** | 9 /** |
10 * Creates a directory object. The path is either a full path or | 10 * Creates a directory object. The path is either a full path or |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 * If the path is the empty string, a default system temp directory and name | 58 * If the path is the empty string, a default system temp directory and name |
59 * are used for the template. | 59 * are used for the template. |
60 * The path is modified to be the path of the new directory. | 60 * The path is modified to be the path of the new directory. |
61 */ | 61 */ |
62 void createTempSync(); | 62 void createTempSync(); |
63 | 63 |
64 /** | 64 /** |
65 * Deletes the directory with this name. If the operation completes | 65 * Deletes the directory with this name. If the operation completes |
66 * successfully the [deleteHandler] is called. Otherwise the | 66 * successfully the [deleteHandler] is called. Otherwise the |
67 * [errorHandler] is called. | 67 * [errorHandler] is called. |
| 68 * |
| 69 * If [recursive] is [:true:] this directory and all sub-directories |
| 70 * and files in the directory are deleted. If [recursive] is |
| 71 * [:false:] only this directory (which must be empty) is |
| 72 * deleted. [recursive] is [:false:] by default. |
68 */ | 73 */ |
69 void delete(); | 74 void delete([bool recursive]); |
70 | 75 |
71 /** | 76 /** |
72 * Deletes the directory with this name. Throws an exception | 77 * Deletes the directory with this name. Throws an exception |
73 * if the directory is not empty or if deletion failed. | 78 * if the directory cannot be deleted. |
| 79 * |
| 80 * If [recursive] is [:true:] this directory and all sub-directories |
| 81 * and files in the directory are deleted. If [recursive] is |
| 82 * [:false:] only this directory (which must be empty) is |
| 83 * deleted. [recursive] is [:false:] by default. |
74 */ | 84 */ |
75 void deleteSync(); | 85 void deleteSync([bool recursive]); |
76 | 86 |
77 /** | 87 /** |
78 * List the sub-directories and files of this | 88 * List the sub-directories and files of this |
79 * [Directory]. Optionally recurse into sub-directories. For each | 89 * [Directory]. Optionally recurse into sub-directories. For each |
80 * file and directory, the file or directory handler is called. When | 90 * file and directory, the file or directory handler is called. When |
81 * all directories have been listed the done handler is called. If | 91 * all directories have been listed the done handler is called. If |
82 * the listing operation is recursive, the error handler is called | 92 * the listing operation is recursive, the error handler is called |
83 * if a subdirectory cannot be opened for listing. | 93 * if a subdirectory cannot be opened for listing. |
84 */ | 94 */ |
85 void list([bool recursive]); | 95 void list([bool recursive]); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 final String path; | 150 final String path; |
141 } | 151 } |
142 | 152 |
143 | 153 |
144 class DirectoryException { | 154 class DirectoryException { |
145 const DirectoryException([String this.message, int this.errorCode = 0]); | 155 const DirectoryException([String this.message, int this.errorCode = 0]); |
146 String toString() => "DirectoryException: $message"; | 156 String toString() => "DirectoryException: $message"; |
147 final String message; | 157 final String message; |
148 final int errorCode; | 158 final int errorCode; |
149 } | 159 } |
OLD | NEW |