Chromium Code Reviews| 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 * Gets the system temp directory. | |
| 72 * | |
| 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 /** | |
| 71 * Creates a temporary directory in this directory. Additional random | 81 * Creates a temporary directory in this directory. Additional random |
| 72 * characters are appended to [template] to produce a unique directory | 82 * characters are appended to [template] to produce a unique directory |
|
Søren Gjesse
2013/10/02 16:57:37
Didn't you decide to call template for prefix?
Bill Hesse
2013/10/03 12:15:19
Fixed, and behavior of missing argument documented
| |
| 73 * name. | 83 * name. |
| 74 * | 84 * |
| 75 * Returns a [:Future<Directory>:] that completes with the newly | 85 * Returns a [:Future<Directory>:] that completes with the newly |
| 76 * created temporary directory. | 86 * created temporary directory. |
| 77 * | 87 * |
| 78 * Deprecated behavior, to be removed Oct 18, 2013: If the path is the | 88 * 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 | 89 * empty string, the directory is created in the default system temp |
| 80 * directory. This capability has been moved to the static function | 90 * directory. This capability has been moved to the static getter |
| 81 * [createSystemTemp]. | 91 * [systemTemp]. |
| 82 */ | 92 */ |
| 83 Future<Directory> createTemp([String template]); | 93 Future<Directory> createTemp([String template]); |
| 84 | 94 |
| 85 /** | 95 /** |
| 86 * Synchronously creates a temporary directory in this directory. | 96 * Synchronously creates a temporary directory in this directory. |
| 87 * Additional random characters are appended to [template] to produce | 97 * Additional random characters are appended to [template] to produce |
| 88 * a unique directory name. | 98 * a unique directory name. |
| 89 * | 99 * |
| 90 * Returns the newly created temporary directory. | 100 * Returns the newly created temporary directory. |
| 91 * | 101 * |
| 92 * Deprecated behavior, to be removed Oct 18, 2013: If the path is the | 102 * 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 | 103 * empty string, the directory is created in the default system temp |
| 94 * directory. This capability has been moved to the static function | 104 * directory. This capability has been moved to the static function |
| 95 * [createSystemTemp]. | 105 * [createSystemTemp]. |
| 96 */ | 106 */ |
| 97 Directory createTempSync([String template]); | 107 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 | 108 |
| 125 Future<String> resolveSymbolicLinks(); | 109 Future<String> resolveSymbolicLinks(); |
| 126 | 110 |
| 127 String resolveSymbolicLinksSync(); | 111 String resolveSymbolicLinksSync(); |
| 128 | 112 |
| 129 /** | 113 /** |
| 130 * Renames this directory. Returns a [:Future<Directory>:] that completes | 114 * Renames this directory. Returns a [:Future<Directory>:] that completes |
| 131 * with a [Directory] instance for the renamed directory. | 115 * with a [Directory] instance for the renamed directory. |
| 132 * | 116 * |
| 133 * If newPath identifies an existing directory, that directory is | 117 * 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) { | 217 if (path != null) { |
| 234 sb.write(", path = $path"); | 218 sb.write(", path = $path"); |
| 235 } | 219 } |
| 236 } | 220 } |
| 237 return sb.toString(); | 221 return sb.toString(); |
| 238 } | 222 } |
| 239 final String message; | 223 final String message; |
| 240 final String path; | 224 final String path; |
| 241 final OSError osError; | 225 final OSError osError; |
| 242 } | 226 } |
| OLD | NEW |