| 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 * [Directory] objects are used for working with directories. | 6 * [Directory] objects are used for working with directories. |
| 7 */ | 7 */ |
| 8 abstract class Directory { | 8 abstract class Directory { |
| 9 /** | 9 /** |
| 10 * Creates a directory object. The path is either an absolute path, | 10 * Creates a directory object. The path is either an absolute path, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 * a [:Future<bool>:] that completes with the result. | 31 * a [:Future<bool>:] that completes with the result. |
| 32 */ | 32 */ |
| 33 Future<bool> exists(); | 33 Future<bool> exists(); |
| 34 | 34 |
| 35 /** | 35 /** |
| 36 * Synchronously check whether a directory with this name already exists. | 36 * Synchronously check whether a directory with this name already exists. |
| 37 */ | 37 */ |
| 38 bool existsSync(); | 38 bool existsSync(); |
| 39 | 39 |
| 40 /** | 40 /** |
| 41 * Creates the directory with this name. If the directory already | 41 * Creates the directory with this name. |
| 42 * exists nothing is done. Returns a [:Future<Directory>:] that | 42 * |
| 43 * completes with this directory once it has been created. If the | 43 * If [recursive] is false, only the last directory in the path is |
| 44 * directory does not exist and cannot be created the future | 44 * created. If [recursive] is true, all non-existing path components |
| 45 * completes with an exception. | 45 * are created. If the directory already exists nothing is done. |
| 46 * |
| 47 * Returns a [:Future<Directory>:] that completes with this |
| 48 * directory once it has been created. If the directory cannot be |
| 49 * created the future completes with an exception. |
| 46 */ | 50 */ |
| 47 Future<Directory> create(); | 51 Future<Directory> create({recursive: false}); |
| 48 | 52 |
| 49 /** | 53 /** |
| 50 * Synchronously creates the directory with this name. If the | 54 * Synchronously creates the directory with this name. |
| 51 * directory already exists nothing is done. If the directory does | 55 * |
| 52 * not exist and cannot be created an exception is thrown. | 56 * If [recursive] is false, only the last directory in the path is |
| 57 * created. If [recursive] is true, all non-existing path components |
| 58 * are created. If the directory already exists nothing is done. |
| 59 * |
| 60 * If the directory cannot be created an exception is thrown. |
| 53 */ | 61 */ |
| 54 void createSync(); | 62 void createSync({recursive: false}); |
| 55 | 63 |
| 56 /** | 64 /** |
| 57 * Creates a temporary directory with a name based on the current | 65 * Creates a temporary directory with a name based on the current |
| 58 * path. This name and path is used as a template, and additional | 66 * path. This name and path is used as a template, and additional |
| 59 * characters are appended to it by the call to make a unique | 67 * characters are appended to it by the call to make a unique |
| 60 * directory name. If the path is the empty string, a default | 68 * directory name. If the path is the empty string, a default |
| 61 * system temp directory and name are used for the template. | 69 * system temp directory and name are used for the template. |
| 62 * | 70 * |
| 63 * Returns a [:Future<Directory>:] that completes with the newly | 71 * Returns a [:Future<Directory>:] that completes with the newly |
| 64 * created temporary directory. | 72 * created temporary directory. |
| 65 */ | 73 */ |
| 66 Future<Directory> createTemp(); | 74 Future<Directory> createTemp(); |
| 67 | 75 |
| 68 /** | 76 /** |
| 69 * Synchronously creates a temporary directory with a name based on the | 77 * Synchronously creates a temporary directory with a name based on the |
| 70 * current path. This name and path is used as a template, and additional | 78 * current path. This name and path is used as a template, and additional |
| 71 * characters are appended to it by the call to make a unique directory name. | 79 * characters are appended to it by the call to make a unique directory name. |
| 72 * If the path is the empty string, a default system temp directory and name | 80 * If the path is the empty string, a default system temp directory and name |
| 73 * are used for the template. Returns the newly created temporary directory. | 81 * are used for the template. Returns the newly created temporary directory. |
| 74 */ | 82 */ |
| 75 Directory createTempSync(); | 83 Directory createTempSync(); |
| 76 | 84 |
| 77 /** | 85 /** |
| 78 * Deletes the directory with this name. The directory must be | 86 * Deletes the directory with this name. |
| 79 * empty. Returns a [:Future<Directory>:] that completes with | 87 * |
| 80 * this directory when the deletion is done. | 88 * If [recursive] is false, the directory must be empty. |
| 89 * |
| 90 * If [recursive] is true, this directory and all sub-directories |
| 91 * and files in the directories are deleted. |
| 92 * |
| 93 * Returns a [:Future<Directory>:] that completes with this |
| 94 * directory when the deletion is done. If the directory cannot be |
| 95 * deleted, the future completes with an exception. |
| 81 */ | 96 */ |
| 82 Future<Directory> delete(); | 97 Future<Directory> delete({recursive: false}); |
| 83 | 98 |
| 84 /** | 99 /** |
| 85 * Synchronously deletes the directory with this name. The directory | 100 * Synchronously deletes the directory with this name. |
| 86 * must be empty. Throws an exception if the directory cannot be | 101 * |
| 87 * deleted. | 102 * If [recursive] is false, the directory must be empty. |
| 103 * |
| 104 * If [recursive] is true, this directory and all sub-directories |
| 105 * and files in the directories are deleted. |
| 106 * |
| 107 * Throws an exception if the directory cannot be deleted. |
| 88 */ | 108 */ |
| 89 void deleteSync(); | 109 void deleteSync({recursive: false}); |
| 90 | |
| 91 /** | |
| 92 * Deletes this directory and all sub-directories and files in the | |
| 93 * directories. Returns a [:Future<Directory>:] that completes with | |
| 94 * this directory when the deletion is done. | |
| 95 */ | |
| 96 Future<Directory> deleteRecursively(); | |
| 97 | |
| 98 /** | |
| 99 * Synchronously deletes this directory and all sub-directories and | |
| 100 * files in the directories. Throws an exception if the directory | |
| 101 * cannot be deleted. | |
| 102 */ | |
| 103 void deleteRecursivelySync(); | |
| 104 | 110 |
| 105 /** | 111 /** |
| 106 * Rename this directory. Returns a [:Future<Directory>:] that completes | 112 * Rename this directory. Returns a [:Future<Directory>:] that completes |
| 107 * with a [Directory] instance for the renamed directory. | 113 * with a [Directory] instance for the renamed directory. |
| 108 * | 114 * |
| 109 * If newPath identifies an existing directory, that directory is | 115 * If newPath identifies an existing directory, that directory is |
| 110 * replaced. If newPath identifies an existing file the operation | 116 * replaced. If newPath identifies an existing file the operation |
| 111 * fails and the future completes with an exception. | 117 * fails and the future completes with an exception. |
| 112 */ | 118 */ |
| 113 Future<Directory> rename(String newPath); | 119 Future<Directory> rename(String newPath); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 if (path != null) { | 207 if (path != null) { |
| 202 sb.add(", path = $path"); | 208 sb.add(", path = $path"); |
| 203 } | 209 } |
| 204 } | 210 } |
| 205 return sb.toString(); | 211 return sb.toString(); |
| 206 } | 212 } |
| 207 final String message; | 213 final String message; |
| 208 final String path; | 214 final String path; |
| 209 final OSError osError; | 215 final OSError osError; |
| 210 } | 216 } |
| OLD | NEW |