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 * [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 { |
| 11 /** | 11 /** |
| 12 * Creates a directory object. The path is either an absolute path, | 12 * Creates a directory object. The path is either an absolute path, |
| 13 * or it is a relative path which is interpreted relative to the directory | 13 * or it is a relative path which is interpreted relative to the directory |
| 14 * in which the Dart VM was started. | 14 * in which the Dart VM was started. |
| 15 */ | 15 */ |
| 16 factory Directory(String path) => new _Directory(path); | 16 factory Directory(String path) => new _Directory(path); |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * Creates a directory object from a Path object. The path is either | 19 * Creates a directory object from a Path object. The path is either |
| 20 * an absolute path, or it is a relative path which is interpreted | 20 * an absolute path, or it is a relative path which is interpreted |
| 21 * relative to the directory in which the Dart VM was started. | 21 * relative to the directory in which the Dart VM was started. |
| 22 */ | 22 */ |
| 23 factory Directory.fromPath(Path path) => new _Directory.fromPath(path); | 23 factory Directory.fromPath(Path path) => new _Directory.fromPath(path); |
| 24 | 24 |
| 25 /** | 25 /** |
| 26 * Creates a directory object pointing to the current working | 26 * Creates a directory object pointing to the current working |
| 27 * directory. | 27 * directory. |
| 28 */ | 28 */ |
| 29 factory Directory.current() => new _Directory.current(); | 29 static Directory get current => _Directory.current; |
| 30 | |
| 31 /** | |
| 32 * Sets the current working directory of the Dart process including | |
| 33 * all running isolates. The value set can be either a [Directory] | |
|
Bill Hesse
2013/04/29 11:01:12
The new value
Søren Gjesse
2013/04/29 11:59:15
Done.
| |
| 34 * or a [String]. | |
| 35 * | |
| 36 * The value set is passed directly to the underlying system call | |
|
Bill Hesse
2013/04/29 11:01:12
The new value is passed to the OS's system call un
Søren Gjesse
2013/04/29 11:59:15
Done.
| |
| 37 * which will take care of resolving relative paths is a relative | |
| 38 * path is passed. | |
| 39 * | |
| 40 * Note that setting the current working directory is a synchronous | |
| 41 * operation and that it changes the the working directory of *all* | |
| 42 * isolates. | |
| 43 * | |
| 44 * Use this with care - especially when working with asynchronous | |
| 45 * operations and multiple isolates. Changing the working directory, | |
| 46 * while asynchronous operations are pending or when other isolates | |
| 47 * are working with the file system, can lead to unexpected results. | |
| 48 */ | |
| 49 static void set current(path) => _Directory.current = path; | |
| 30 | 50 |
| 31 /** | 51 /** |
| 32 * Check whether a directory with this name already exists. Returns | 52 * Check whether a directory with this name already exists. Returns |
| 33 * a [:Future<bool>:] that completes with the result. | 53 * a [:Future<bool>:] that completes with the result. |
| 34 */ | 54 */ |
| 35 Future<bool> exists(); | 55 Future<bool> exists(); |
| 36 | 56 |
| 37 /** | 57 /** |
| 38 * Synchronously check whether a directory with this name already exists. | 58 * Synchronously check whether a directory with this name already exists. |
| 39 */ | 59 */ |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 if (path != null) { | 239 if (path != null) { |
| 220 sb.write(", path = $path"); | 240 sb.write(", path = $path"); |
| 221 } | 241 } |
| 222 } | 242 } |
| 223 return sb.toString(); | 243 return sb.toString(); |
| 224 } | 244 } |
| 225 final String message; | 245 final String message; |
| 226 final String path; | 246 final String path; |
| 227 final OSError osError; | 247 final OSError osError; |
| 228 } | 248 } |
| OLD | NEW |