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. Throws an exception if the path does not specify a | 9 * started. |
10 * directory. | |
11 */ | 10 */ |
12 Directory.open(String dir); | 11 Directory(String dir); |
13 | |
14 /** | |
15 * Close this [Directory]. Terminates listing operation if one is in | |
16 * progress. Returns a boolean indicating whether the close operation | |
17 * succeeded. | |
18 */ | |
19 bool close(); | |
20 | 12 |
21 /** | 13 /** |
22 * List the sub-directories and files of this | 14 * List the sub-directories and files of this |
23 * [Directory]. Optionally recurse into sub-directories. For each | 15 * [Directory]. Optionally recurse into sub-directories. For each |
24 * file and directory, the file or directory handler is called. When | 16 * file and directory, the file or directory handler is called. When |
25 * all directories have been listed the done handler is called. If | 17 * all directories have been listed the done handler is called. If |
26 * the listing operation is recursive, the directory error handler | 18 * the listing operation is recursive, the error handler is called |
27 * is called if a subdirectory cannot be opened for listing. | 19 * if a subdirectory cannot be opened for listing. |
28 */ | 20 */ |
29 void list([bool recursive]); | 21 void list([bool recursive]); |
30 | 22 |
31 /** | 23 /** |
32 * Sets the directory handler that is called for all directories | 24 * Sets the directory handler that is called for all directories |
33 * during listing operations. The directory handler is called with | 25 * during listing operations. The directory handler is called with |
34 * the full path of the directory. | 26 * the full path of the directory. |
35 */ | 27 */ |
36 void setDirHandler(void dirHandler(String dir)); | 28 void setDirHandler(void dirHandler(String dir)); |
37 | 29 |
38 /** | 30 /** |
39 * Sets the file handler that is called for all directories during | 31 * Sets the file handler that is called for all files during listing |
40 * listing operations. The directory handler is called with the full | 32 * operations. The file handler is called with the full path of the |
41 * path of the file. | 33 * file. |
42 */ | 34 */ |
43 void setFileHandler(void fileHandler(String file)); | 35 void setFileHandler(void fileHandler(String file)); |
44 | 36 |
45 /** | 37 /** |
46 * Set the done handler that is called either when a directory | 38 * Set the done handler that is called when a directory listing is |
47 * listing is completed or when the close method is called. | 39 * done. The handler is called with an indication of whether or not |
40 * the listing operation completed. | |
Søren Gjesse
2011/10/12 09:30:30
What does "not completed" actually mean? Will the
Mads Ager (google)
2011/10/12 10:36:28
Good question. :)
Currently, done means that no e
| |
48 */ | 41 */ |
49 void setDoneHandler(void doneHandler(bool completed)); | 42 void setDoneHandler(void doneHandler(bool completed)); |
50 | 43 |
51 /** | 44 /** |
52 * Set the directory error handler that is called for all | 45 * Sets the error handler that is called on errors listing |
53 * directories that cannot be opened for listing during recursive | 46 * directories. |
54 * listing. | |
55 */ | 47 */ |
56 void setDirErrorHandler(void errorHandler(String dir)); | 48 void setErrorHandler(void errorHandler(String error)); |
57 } | 49 } |
OLD | NEW |