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

Unified 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, 8 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/directory.dart
diff --git a/sdk/lib/io/directory.dart b/sdk/lib/io/directory.dart
index 8c0ad5abd05cf07d234a26a0e0a001a8241cd45d..59dc529522944d1876c62d2dacb21363fc5b63df 100644
--- a/sdk/lib/io/directory.dart
+++ b/sdk/lib/io/directory.dart
@@ -26,7 +26,29 @@ abstract class Directory extends FileSystemEntity {
* Creates a directory object pointing to the current working
* directory.
*/
- factory Directory.current() => new _Directory.current();
+ static Directory get current => _Directory.current;
+
+ /**
+ * Sets the current working directory of the Dart process including
+ * all running isolates. The new value set can be either a [Directory]
+ * or a [String].
+ *
+ * The new value is passed to the OS's system call unchanged, so a
+ * relative path passed as the new working directory will be
+ * resolved by the OS.
+ *
+ * Note that setting the current working directory is a synchronous
+ * operation and that it changes the the working directory of *all*
+ * isolates.
+ *
+ * Use this with care - especially when working with asynchronous
+ * operations and multiple isolates. Changing the working directory,
+ * while asynchronous operations are pending or when other isolates
+ * are working with the file system, can lead to unexpected results.
+ */
+ static void set current(path) {
+ _Directory.current = path;
+ }
/**
* Check whether a directory with this name already exists. Returns
« 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