| 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 abstract class Directory { |
| 9 /** | 9 /** |
| 10 * Creates a directory object. The path is either an absolute path, | 10 * Creates a directory object. The path is either an absolute path, |
| 11 * or it is a relative path which is interpreted relative to the directory | 11 * or it is a relative path which is interpreted relative to the directory |
| 12 * in which the Dart VM was started. | 12 * in which the Dart VM was started. |
| 13 */ | 13 */ |
| 14 Directory(String path); | 14 factory Directory(String path) => new _Directory(path); |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * Creates a directory object from a Path object. The path is either | 17 * Creates a directory object from a Path object. The path is either |
| 18 * an absolute path, or it is a relative path which is interpreted | 18 * an absolute path, or it is a relative path which is interpreted |
| 19 * relative to the directory in which the Dart VM was started. | 19 * relative to the directory in which the Dart VM was started. |
| 20 */ | 20 */ |
| 21 Directory.fromPath(Path path); | 21 factory Directory.fromPath(Path path) => new _Directory.fromPath(path); |
| 22 | 22 |
| 23 /** | 23 /** |
| 24 * Creates a directory object pointing to the current working | 24 * Creates a directory object pointing to the current working |
| 25 * directory. | 25 * directory. |
| 26 */ | 26 */ |
| 27 Directory.current(); | 27 factory Directory.current() => new _Directory.current(); |
| 28 | 28 |
| 29 /** | 29 /** |
| 30 * Check whether a directory with this name already exists. Returns | 30 * Check whether a directory with this name already exists. Returns |
| 31 * a [:Future<bool>:] that completes with the result. | 31 * a [:Future<bool>:] that completes with the result. |
| 32 */ | 32 */ |
| 33 Future<bool> exists(); | 33 Future<bool> exists(); |
| 34 | 34 |
| 35 /** | 35 /** |
| 36 * Synchronously check whether a directory with this name already exists. | 36 * Synchronously check whether a directory with this name already exists. |
| 37 */ | 37 */ |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 */ | 119 */ |
| 120 Directory renameSync(String newPath); | 120 Directory renameSync(String newPath); |
| 121 | 121 |
| 122 /** | 122 /** |
| 123 * List the sub-directories and files of this | 123 * List the sub-directories and files of this |
| 124 * [Directory]. Optionally recurse into sub-directories. Returns a | 124 * [Directory]. Optionally recurse into sub-directories. Returns a |
| 125 * [DirectoryLister] object representing the active listing | 125 * [DirectoryLister] object representing the active listing |
| 126 * operation. Handlers for files and directories should be | 126 * operation. Handlers for files and directories should be |
| 127 * registered on this DirectoryLister object. | 127 * registered on this DirectoryLister object. |
| 128 */ | 128 */ |
| 129 DirectoryLister list([bool recursive]); | 129 DirectoryLister list([bool recursive = false]); |
| 130 | 130 |
| 131 /** | 131 /** |
| 132 * Gets the path of this directory. | 132 * Gets the path of this directory. |
| 133 */ | 133 */ |
| 134 final String path; | 134 final String path; |
| 135 } | 135 } |
| 136 | 136 |
| 137 | 137 |
| 138 /** | 138 /** |
| 139 * A [DirectoryLister] represents an actively running listing operation. | 139 * A [DirectoryLister] represents an actively running listing operation. |
| 140 * | 140 * |
| 141 * For each file and directory, the file or directory handler is | 141 * For each file and directory, the file or directory handler is |
| 142 * called. When all directories have been listed the done handler is | 142 * called. When all directories have been listed the done handler is |
| 143 * called. If the listing operation is recursive, the error handler is | 143 * called. If the listing operation is recursive, the error handler is |
| 144 * called if a subdirectory cannot be opened for listing. | 144 * called if a subdirectory cannot be opened for listing. |
| 145 */ | 145 */ |
| 146 interface DirectoryLister default _DirectoryLister { | 146 abstract class DirectoryLister { |
| 147 /** | 147 /** |
| 148 * Sets the directory handler that is called for all directories | 148 * Sets the directory handler that is called for all directories |
| 149 * during listing. The directory handler is called with the full | 149 * during listing. The directory handler is called with the full |
| 150 * path of the directory. | 150 * path of the directory. |
| 151 */ | 151 */ |
| 152 void set onDir(void onDir(String dir)); | 152 void set onDir(void onDir(String dir)); |
| 153 | 153 |
| 154 /** | 154 /** |
| 155 * Sets the handler that is called for all files during listing. The | 155 * Sets the handler that is called for all files during listing. The |
| 156 * file handler is called with the full path of the file. | 156 * file handler is called with the full path of the file. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 if (path != null) { | 192 if (path != null) { |
| 193 sb.add(", path = $path"); | 193 sb.add(", path = $path"); |
| 194 } | 194 } |
| 195 } | 195 } |
| 196 return sb.toString(); | 196 return sb.toString(); |
| 197 } | 197 } |
| 198 final String message; | 198 final String message; |
| 199 final String path; | 199 final String path; |
| 200 final OSError osError; | 200 final OSError osError; |
| 201 } | 201 } |
| OLD | NEW |