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 extends FileSystemEntity { | 10 abstract class Directory extends FileSystemEntity { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 * current path. The path is used as a template, and additional | 80 * current path. The path is used as a template, and additional |
81 * characters are appended to it to make a unique temporary directory name. | 81 * characters are appended to it to make a unique temporary directory name. |
82 * If the path is the empty string, a default system temp directory and name | 82 * If the path is the empty string, a default system temp directory and name |
83 * are used for the template. Returns the newly created temporary directory. | 83 * are used for the template. Returns the newly created temporary directory. |
84 */ | 84 */ |
85 Directory createTempSync(); | 85 Directory createTempSync(); |
86 | 86 |
87 /** | 87 /** |
88 * Deletes this directory. | 88 * Deletes this directory. |
89 * | 89 * |
90 * If [recursive] is false, the directory must be empty. | 90 * If [recursive] is false, the directory must be empty. Only directories |
91 * and links to directories will be deleted. | |
91 * | 92 * |
92 * If [recursive] is true, this directory and all sub-directories | 93 * If [recursive] is true, this directory and all sub-directories |
93 * and files in the directories are deleted. | 94 * and files in the directories are deleted. Links are not followed |
95 * when deleting recursively. Only the link is deleted, not its target. | |
96 * | |
97 * If [recursive] is true, the target is deleted even if it is a file, or | |
98 * a link to a file, not only if it is a directory. This behavior allows | |
99 * [delete] to be used to unconditionally delete the file system object at | |
Anders Johnsen
2013/04/09 16:34:36
'delete any file system object'
Bill Hesse
2013/04/10 08:07:07
Done.
| |
100 * a given location. | |
Anders Johnsen
2013/04/09 16:34:36
location or path?
| |
94 * | 101 * |
95 * Returns a [:Future<Directory>:] that completes with this | 102 * Returns a [:Future<Directory>:] that completes with this |
96 * directory when the deletion is done. If the directory cannot be | 103 * directory when the deletion is done. If the directory cannot be |
97 * deleted, the future completes with an exception. | 104 * deleted, the future completes with an exception. |
98 */ | 105 */ |
99 Future<Directory> delete({recursive: false}); | 106 Future<Directory> delete({recursive: false}); |
100 | 107 |
101 /** | 108 /** |
102 * Synchronously deletes this directory. | 109 * Synchronously deletes this directory. |
103 * | 110 * |
104 * If [recursive] is false, the directory must be empty. | 111 * If [recursive] is false, the directory must be empty. |
105 * | 112 * |
106 * If [recursive] is true, this directory and all sub-directories | 113 * If [recursive] is true, this directory and all sub-directories |
107 * and files in the directories are deleted. | 114 * and files in the directories are deleted. Links are not followed |
115 * when deleting recursively. Only the link is deleted, not its target. | |
116 * | |
117 * If [recursive] is true, the target is deleted even if it is a file, or | |
118 * a link to a file, not only if it is a directory. This behavior allows | |
119 * [delete] to be used to unconditionally delete the file system object at | |
120 * a given location. | |
108 * | 121 * |
109 * Throws an exception if the directory cannot be deleted. | 122 * Throws an exception if the directory cannot be deleted. |
110 */ | 123 */ |
111 void deleteSync({recursive: false}); | 124 void deleteSync({recursive: false}); |
112 | 125 |
113 /** | 126 /** |
114 * Renames this directory. Returns a [:Future<Directory>:] that completes | 127 * Renames this directory. Returns a [:Future<Directory>:] that completes |
115 * with a [Directory] instance for the renamed directory. | 128 * with a [Directory] instance for the renamed directory. |
116 * | 129 * |
117 * If newPath identifies an existing directory, that directory is | 130 * If newPath identifies an existing directory, that directory is |
(...skipping 10 matching lines...) Expand all Loading... | |
128 * replaced. If newPath identifies an existing file the operation | 141 * replaced. If newPath identifies an existing file the operation |
129 * fails and an exception is thrown. | 142 * fails and an exception is thrown. |
130 */ | 143 */ |
131 Directory renameSync(String newPath); | 144 Directory renameSync(String newPath); |
132 | 145 |
133 /** | 146 /** |
134 * Lists the sub-directories and files of this [Directory]. | 147 * Lists the sub-directories and files of this [Directory]. |
135 * Optionally recurses into sub-directories. | 148 * Optionally recurses into sub-directories. |
136 * | 149 * |
137 * If [followLinks] is false, then any symbolic links found | 150 * If [followLinks] is false, then any symbolic links found |
138 * are reported as links, rather than as directories or files, | 151 * are reported as [Link] objects, rather than as directories or files, |
139 * and are not recursed into. | 152 * and are not recursed into. |
140 * | 153 * |
154 * If [followLinks] is true, then broken links are reported as [Link] objects, | |
Anders Johnsen
2013/04/09 16:34:36
I think the broken-links part should be in the end
Bill Hesse
2013/04/10 08:07:07
Done.
| |
155 * but working links are reported as a directories or files, depending on | |
156 * their type, and links to directories are recursed into. | |
157 * | |
141 * The result is a stream of [FileSystemEntity] objects | 158 * The result is a stream of [FileSystemEntity] objects |
142 * for the directories, files, and links. | 159 * for the directories, files, and links. |
143 */ | 160 */ |
144 Stream<FileSystemEntity> list({bool recursive: false, | 161 Stream<FileSystemEntity> list({bool recursive: false, |
145 bool followLinks: true}); | 162 bool followLinks: true}); |
146 | 163 |
147 /** | 164 /** |
148 * Lists the sub-directories and files of this [Directory]. | 165 * Lists the sub-directories and files of this [Directory]. |
149 * Optionally recurses into sub-directories. | 166 * Optionally recurses into sub-directories. |
150 * | 167 * |
151 * If [followLinks] is false, then any symbolic links found | 168 * If [followLinks] is false, then any symbolic links found |
152 * are reported as links, rather than as directories or files, | 169 * are reported as [Link] objects, rather than as directories or files, |
153 * and are not recursed into. | 170 * and are not recursed into. |
154 * | 171 * |
172 * If [followLinks] is true, then broken links are reported as [Link] objects, | |
173 * but working links are reported as directories or files, depending on | |
174 * their type, and links to directories are recursed into. | |
175 * | |
155 * Returns a [List] containing [FileSystemEntity] objects for the | 176 * Returns a [List] containing [FileSystemEntity] objects for the |
156 * directories, files, and links. | 177 * directories, files, and links. |
157 */ | 178 */ |
158 List<FileSystemEntity> listSync({bool recursive: false, | 179 List<FileSystemEntity> listSync({bool recursive: false, |
159 bool followLinks: true}); | 180 bool followLinks: true}); |
160 | 181 |
161 /** | 182 /** |
162 * Returns a human readable string for this Directory instance. | 183 * Returns a human readable string for this Directory instance. |
163 */ | 184 */ |
164 String toString(); | 185 String toString(); |
(...skipping 25 matching lines...) Expand all Loading... | |
190 if (path != null) { | 211 if (path != null) { |
191 sb.write(", path = $path"); | 212 sb.write(", path = $path"); |
192 } | 213 } |
193 } | 214 } |
194 return sb.toString(); | 215 return sb.toString(); |
195 } | 216 } |
196 final String message; | 217 final String message; |
197 final String path; | 218 final String path; |
198 final OSError osError; | 219 final OSError osError; |
199 } | 220 } |
OLD | NEW |