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

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

Issue 57943002: Add fromUri constructor to File, Directory and Link (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added tests Created 7 years, 1 month 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
Index: sdk/lib/io/link.dart
diff --git a/sdk/lib/io/link.dart b/sdk/lib/io/link.dart
index 82aef2a5450b9f971921fd6e8a3e909fbf2c921c..68920a60e402c6ea0706b9ffc03715e7eac5874f 100644
--- a/sdk/lib/io/link.dart
+++ b/sdk/lib/io/link.dart
@@ -15,6 +15,12 @@ abstract class Link implements FileSystemEntity {
factory Link(String path) => new _Link(path);
/**
+ * Create a Lint object from a URI.
+ *
+ * If [uri] cannot reference a link this throws [UnsupportedError].
+ */
+ factory Link.fromUri(Uri uri) => new _Link.fromUri(uri);
+ /**
* Creates a symbolic link. Returns a [:Future<Link>:] that completes with
* the link when it has been created. If the link exists,
* the future will complete with an error.
@@ -143,6 +149,7 @@ class _Link extends FileSystemEntity implements Link {
}
}
+ factory _Link.fromUri(Uri uri) => new _Link(uri.toFilePath());
String toString() => "Link: '$path'";

Powered by Google App Engine
This is Rietveld 408576698