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

Unified Diff: sdk/lib/io/directory_impl.dart

Issue 23702037: Fix error handling when current working directory is deleted. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix type of _Directory._current Created 7 years, 3 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/lib/io_patch.dart ('k') | tests/standalone/io/directory_chdir_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/directory_impl.dart
diff --git a/sdk/lib/io/directory_impl.dart b/sdk/lib/io/directory_impl.dart
index f54a6413c1e938fc9b2d7ef8b85038f9caff18d8..685720e5721b114bbbaeeab35c31bb977728bc5c 100644
--- a/sdk/lib/io/directory_impl.dart
+++ b/sdk/lib/io/directory_impl.dart
@@ -24,7 +24,7 @@ class _Directory extends FileSystemEntity implements Directory {
}
}
- external static String _current();
+ external static _current();
external static _setCurrent(path);
external static _createTemp(String template);
external static int _exists(String path);
@@ -34,7 +34,14 @@ class _Directory extends FileSystemEntity implements Directory {
external static List _list(String path, bool recursive, bool followLinks);
external static SendPort _newServicePort();
- static Directory get current => new _Directory(_current());
+ static Directory get current {
+ var result = _current();
+ if (result is OSError) {
+ throw new DirectoryException(
+ "Getting current working directory failed", "", result);
+ }
+ return new _Directory(result);
+ }
static void set current(path) {
if (path is Directory) path = path.path;
« no previous file with comments | « sdk/lib/_internal/lib/io_patch.dart ('k') | tests/standalone/io/directory_chdir_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698