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 * Helper functionality to make working with IO easier. | 6 * Helper functionality to make working with IO easier. |
7 */ | 7 */ |
8 library io; | 8 library io; |
9 | 9 |
10 import 'dart:io'; | 10 import 'dart:io'; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 dir = _getDirectory(dir); | 215 dir = _getDirectory(dir); |
216 return dir.createTemp(); | 216 return dir.createTemp(); |
217 } | 217 } |
218 | 218 |
219 /** | 219 /** |
220 * Asynchronously recursively deletes [dir], which can be a [String] or a | 220 * Asynchronously recursively deletes [dir], which can be a [String] or a |
221 * [Directory]. Returns a [Future] that completes when the deletion is done. | 221 * [Directory]. Returns a [Future] that completes when the deletion is done. |
222 */ | 222 */ |
223 Future<Directory> deleteDir(dir) { | 223 Future<Directory> deleteDir(dir) { |
224 dir = _getDirectory(dir); | 224 dir = _getDirectory(dir); |
225 return dir.deleteRecursively(); | 225 return dir.delete(recursive: true); |
226 } | 226 } |
227 | 227 |
228 /** | 228 /** |
229 * Asynchronously lists the contents of [dir], which can be a [String] directory | 229 * Asynchronously lists the contents of [dir], which can be a [String] directory |
230 * path or a [Directory]. If [recursive] is `true`, lists subdirectory contents | 230 * path or a [Directory]. If [recursive] is `true`, lists subdirectory contents |
231 * (defaults to `false`). If [includeSpecialFiles] is `true`, includes | 231 * (defaults to `false`). If [includeSpecialFiles] is `true`, includes |
232 * hidden `.DS_Store` files (defaults to `false`, other hidden files may be | 232 * hidden `.DS_Store` files (defaults to `false`, other hidden files may be |
233 * omitted later). | 233 * omitted later). |
234 */ | 234 */ |
235 Future<List<String>> listDir(dir, | 235 Future<List<String>> listDir(dir, |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 return new Directory(entry); | 761 return new Directory(entry); |
762 } | 762 } |
763 | 763 |
764 /** | 764 /** |
765 * Gets a [Uri] for [uri], which can either already be one, or be a [String]. | 765 * Gets a [Uri] for [uri], which can either already be one, or be a [String]. |
766 */ | 766 */ |
767 Uri _getUri(uri) { | 767 Uri _getUri(uri) { |
768 if (uri is Uri) return uri; | 768 if (uri is Uri) return uri; |
769 return new Uri.fromString(uri); | 769 return new Uri.fromString(uri); |
770 } | 770 } |
OLD | NEW |