| 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 * A reference to a directory (or _folder_) on the file system. | 8 * A reference to a directory (or _folder_) on the file system. |
| 9 */ | 9 */ |
| 10 abstract class Directory implements FileSystemEntity { | 10 abstract class Directory implements FileSystemEntity { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 * | 61 * |
| 62 * If [recursive] is false, only the last directory in the path is | 62 * If [recursive] is false, only the last directory in the path is |
| 63 * created. If [recursive] is true, all non-existing path components | 63 * created. If [recursive] is true, all non-existing path components |
| 64 * are created. If the directory already exists nothing is done. | 64 * are created. If the directory already exists nothing is done. |
| 65 * | 65 * |
| 66 * If the directory cannot be created an exception is thrown. | 66 * If the directory cannot be created an exception is thrown. |
| 67 */ | 67 */ |
| 68 void createSync({bool recursive: false}); | 68 void createSync({bool recursive: false}); |
| 69 | 69 |
| 70 /** | 70 /** |
| 71 * Creates a temporary directory in this directory. Additional random | 71 * Gets the system temp directory. |
| 72 * characters are appended to [template] to produce a unique directory | 72 * |
| 73 * name. | 73 * Gets the directory provided by the operating system for creating |
| 74 * temporary files and directories in. |
| 75 * The location of the system temp directory is platform-dependent, |
| 76 * and may be set by an environment variable. |
| 77 */ |
| 78 static Directory get systemTemp => _Directory.systemTemp; |
| 79 |
| 80 /** |
| 81 * Creates a temporary directory in this directory. Additional random |
| 82 * characters are appended to [prefix] to produce a unique directory |
| 83 * name. If [prefix] is missing or null, the empty string is used |
| 84 * for [prefix]. |
| 74 * | 85 * |
| 75 * Returns a [:Future<Directory>:] that completes with the newly | 86 * Returns a [:Future<Directory>:] that completes with the newly |
| 76 * created temporary directory. | 87 * created temporary directory. |
| 77 * | 88 * |
| 78 * Deprecated behavior, to be removed Oct 18, 2013: If the path is the | 89 * Deprecated behavior, to be removed Oct 18, 2013: If the path is the |
| 79 * empty string, the directory is created in the default system temp | 90 * empty string, the directory is created in the default system temp |
| 80 * directory. This capability has been moved to the static function | 91 * directory. This capability has been moved to the static getter |
| 81 * [createSystemTemp]. | 92 * [systemTemp]. |
| 82 */ | 93 */ |
| 83 Future<Directory> createTemp([String template]); | 94 Future<Directory> createTemp([String template]); |
| 84 | 95 |
| 85 /** | 96 /** |
| 86 * Synchronously creates a temporary directory in this directory. | 97 * Synchronously creates a temporary directory in this directory. |
| 87 * Additional random characters are appended to [template] to produce | 98 * Additional random characters are appended to [prefix] to produce |
| 88 * a unique directory name. | 99 * a unique directory name. If [prefix] is missing or null, the empty |
| 100 * string is used for [prefix]. |
| 89 * | 101 * |
| 90 * Returns the newly created temporary directory. | 102 * Returns the newly created temporary directory. |
| 91 * | 103 * |
| 92 * Deprecated behavior, to be removed Oct 18, 2013: If the path is the | 104 * Deprecated behavior, to be removed Oct 18, 2013: If the path is the |
| 93 * empty string, the directory is created in the default system temp | 105 * empty string, the directory is created in the default system temp |
| 94 * directory. This capability has been moved to the static function | 106 * directory. This capability has been moved to the static function |
| 95 * [createSystemTemp]. | 107 * [createSystemTemp]. |
| 96 */ | 108 */ |
| 97 Directory createTempSync([String template]); | 109 Directory createTempSync([String template]); |
| 98 | |
| 99 /** | |
| 100 * Creates a temporary directory in the system temp directory. | |
| 101 * The location of the system temp directory is platform-dependent, | |
| 102 * and may be set by an environment variable. | |
| 103 * Additional random characters are appended to [template] to produce | |
| 104 * a unique directory name. | |
| 105 * | |
| 106 * Returns a [:Future<Directory>:] that completes with the newly | |
| 107 * created temporary directory. | |
| 108 */ | |
| 109 static Future<Directory> createSystemTemp([String template]) => | |
| 110 _Directory.createSystemTemp(template); | |
| 111 | |
| 112 /** | |
| 113 * Synchronously creates a temporary directory in the system temp directory. | |
| 114 * The location of the system temp directory is platform-dependent, | |
| 115 * and may be set by an environment variable. | |
| 116 * Additional random characters are appended to [template] to produce | |
| 117 * a unique directory name. | |
| 118 * | |
| 119 * Returns a [:Future<Directory>:] that completes with the newly | |
| 120 * created temporary directory. | |
| 121 */ | |
| 122 static Directory createSystemTempSync([String template]) => | |
| 123 _Directory.createSystemTempSync(template); | |
| 124 | 110 |
| 125 Future<String> resolveSymbolicLinks(); | 111 Future<String> resolveSymbolicLinks(); |
| 126 | 112 |
| 127 String resolveSymbolicLinksSync(); | 113 String resolveSymbolicLinksSync(); |
| 128 | 114 |
| 129 /** | 115 /** |
| 130 * Renames this directory. Returns a [:Future<Directory>:] that completes | 116 * Renames this directory. Returns a [:Future<Directory>:] that completes |
| 131 * with a [Directory] instance for the renamed directory. | 117 * with a [Directory] instance for the renamed directory. |
| 132 * | 118 * |
| 133 * If newPath identifies an existing directory, that directory is | 119 * If newPath identifies an existing directory, that directory is |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 if (path != null) { | 219 if (path != null) { |
| 234 sb.write(", path = $path"); | 220 sb.write(", path = $path"); |
| 235 } | 221 } |
| 236 } | 222 } |
| 237 return sb.toString(); | 223 return sb.toString(); |
| 238 } | 224 } |
| 239 final String message; | 225 final String message; |
| 240 final String path; | 226 final String path; |
| 241 final OSError osError; | 227 final OSError osError; |
| 242 } | 228 } |
| OLD | NEW |