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 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 /** | 7 /** |
8 * [Directory] objects are used for working with directories. | 8 * [Directory] objects are used for working with directories. |
9 */ | 9 */ |
10 abstract class Directory implements FileSystemEntity { | 10 abstract class Directory implements FileSystemEntity { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 /** | 82 /** |
83 * Synchronously creates a temporary directory with a name based on the | 83 * Synchronously creates a temporary directory with a name based on the |
84 * current path. The path is used as a template, and additional | 84 * current path. The path is used as a template, and additional |
85 * characters are appended to it to make a unique temporary directory name. | 85 * characters are appended to it to make a unique temporary directory name. |
86 * If the path is the empty string, a default system temp directory and name | 86 * If the path is the empty string, a default system temp directory and name |
87 * are used for the template. Returns the newly created temporary directory. | 87 * are used for the template. Returns the newly created temporary directory. |
88 */ | 88 */ |
89 Directory createTempSync(); | 89 Directory createTempSync(); |
90 | 90 |
91 /** | 91 /** |
92 * Deletes this directory. | |
93 * | |
94 * If [recursive] is false, the directory must be empty. Only directories | |
95 * and links to directories will be deleted. | |
96 * | |
97 * If [recursive] is true, this directory and all sub-directories | |
98 * and files in the directories are deleted. Links are not followed | |
99 * when deleting recursively. Only the link is deleted, not its target. | |
100 * | |
101 * If [recursive] is true, the target is deleted even if it is a file, or | |
102 * a link to a file, not only if it is a directory. This behavior allows | |
103 * [delete] to be used to unconditionally delete any file system object. | |
104 * | |
105 * Returns a [:Future<Directory>:] that completes with this | |
106 * directory when the deletion is done. If the directory cannot be | |
107 * deleted, the future completes with an exception. | |
108 */ | |
109 Future<Directory> delete({recursive: false}); | |
110 | |
111 /** | |
112 * Synchronously deletes this directory. | |
113 * | |
114 * If [recursive] is false, the directory must be empty. | |
115 * | |
116 * If [recursive] is true, this directory and all sub-directories | |
117 * and files in the directories are deleted. Links are not followed | |
118 * when deleting recursively. Only the link is deleted, not its target. | |
119 * | |
120 * If [recursive] is true, the target is deleted even if it is a file, or | |
121 * a link to a file, not only if it is a directory. This behavior allows | |
122 * [delete] to be used to unconditionally delete any file system object. | |
123 * | |
124 * Throws an exception if the directory cannot be deleted. | |
125 */ | |
126 void deleteSync({recursive: false}); | |
127 | |
128 /** | |
129 * Renames this directory. Returns a [:Future<Directory>:] that completes | 92 * Renames this directory. Returns a [:Future<Directory>:] that completes |
130 * with a [Directory] instance for the renamed directory. | 93 * with a [Directory] instance for the renamed directory. |
131 * | 94 * |
132 * If newPath identifies an existing directory, that directory is | 95 * If newPath identifies an existing directory, that directory is |
133 * replaced. If newPath identifies an existing file, the operation | 96 * replaced. If newPath identifies an existing file, the operation |
134 * fails and the future completes with an exception. | 97 * fails and the future completes with an exception. |
135 */ | 98 */ |
136 Future<Directory> rename(String newPath); | 99 Future<Directory> rename(String newPath); |
137 | 100 |
138 /** | 101 /** |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 if (path != null) { | 186 if (path != null) { |
224 sb.write(", path = $path"); | 187 sb.write(", path = $path"); |
225 } | 188 } |
226 } | 189 } |
227 return sb.toString(); | 190 return sb.toString(); |
228 } | 191 } |
229 final String message; | 192 final String message; |
230 final String path; | 193 final String path; |
231 final OSError osError; | 194 final OSError osError; |
232 } | 195 } |
OLD | NEW |