Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: sdk/lib/io/directory.dart

Issue 13896034: Add the ability to change the working directory (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed tests Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 new value set can be either a [Directory]
34 * or a [String].
35 *
36 * The new value is passed to the OS's system call unchanged, so a
37 * relative path passed as the new working directory will be
38 * resolved by the OS.
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) {
50 _Directory.current = path;
51 }
30 52
31 /** 53 /**
32 * Check whether a directory with this name already exists. Returns 54 * Check whether a directory with this name already exists. Returns
33 * a [:Future<bool>:] that completes with the result. 55 * a [:Future<bool>:] that completes with the result.
34 */ 56 */
35 Future<bool> exists(); 57 Future<bool> exists();
36 58
37 /** 59 /**
38 * Synchronously check whether a directory with this name already exists. 60 * Synchronously check whether a directory with this name already exists.
39 */ 61 */
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 if (path != null) { 241 if (path != null) {
220 sb.write(", path = $path"); 242 sb.write(", path = $path");
221 } 243 }
222 } 244 }
223 return sb.toString(); 245 return sb.toString();
224 } 246 }
225 final String message; 247 final String message;
226 final String path; 248 final String path;
227 final OSError osError; 249 final OSError osError;
228 } 250 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/io_patch.dart ('k') | sdk/lib/io/directory_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698