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 existsSync(); | 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 createSync(); | 22 void createSync(); |
23 | 23 |
24 /** | 24 /** |
25 * Creates a temporary directory with a name based on this name. | |
26 * This name is used as a template, and must contain consecutive | |
27 * 'X' characters, which will be replaced to create a uniqe directory name. | |
Mads Ager (google)
2011/11/18 09:50:45
unique?
Is there a requirement on the number of '
Bill Hesse
2011/11/21 15:48:41
Changed. The template is the path, and the unique
| |
28 * The new directory object will be passed to the provided callback, | |
29 * once it is created. The original directory object is unchanged. | |
30 * Throw an exception if the temporary directory cannot be created. | |
31 * The new directory inherits all handlers from the template directory. | |
32 */ | |
33 void createTemp(void createdHandler(Directory tempDir)); | |
Mads Ager (google)
2011/11/18 09:50:45
Please follow the style in the rest of the file an
| |
34 | |
35 /** | |
25 * Deletes the directory with this name. Throws an exception | 36 * Deletes the directory with this name. Throws an exception |
26 * if the directory is not empty or if deletion failed. | 37 * if the directory is not empty or if deletion failed. |
27 */ | 38 */ |
28 void deleteSync(); | 39 void deleteSync(); |
29 | 40 |
30 /** | 41 /** |
31 * List the sub-directories and files of this | 42 * List the sub-directories and files of this |
32 * [Directory]. Optionally recurse into sub-directories. For each | 43 * [Directory]. Optionally recurse into sub-directories. For each |
33 * file and directory, the file or directory handler is called. When | 44 * file and directory, the file or directory handler is called. When |
34 * all directories have been listed the done handler is called. If | 45 * all directories have been listed the done handler is called. If |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 */ | 79 */ |
69 final String path; | 80 final String path; |
70 } | 81 } |
71 | 82 |
72 | 83 |
73 class DirectoryException { | 84 class DirectoryException { |
74 const DirectoryException(String this.message); | 85 const DirectoryException(String this.message); |
75 String toString() => "DirectoryException: $message"; | 86 String toString() => "DirectoryException: $message"; |
76 final String message; | 87 final String message; |
77 } | 88 } |
OLD | NEW |