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

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

Issue 13800002: dart:io | Add asynchronous Link.create implementation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/io/file_impl.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/link.dart
diff --git a/sdk/lib/io/link.dart b/sdk/lib/io/link.dart
index 215e22cbd8d6682665536e5e350fc860393bf7b8..bce4bfb5ffdcd21729d13da805606ad6df1a5fde 100644
--- a/sdk/lib/io/link.dart
+++ b/sdk/lib/io/link.dart
@@ -124,9 +124,16 @@ class _Link extends FileSystemEntity implements Link {
bool existsSync() => FileSystemEntity.isLinkSync(path);
Future<Link> create(String target) {
- // TODO(whesse): Replace with asynchronous version.
- return new Future.of(() {
- createSync(target);
+ _ensureFileService();
+ List request = new List(3);
+ request[0] = _CREATE_LINK_REQUEST;
+ request[1] = path;
+ request[2] = target;
+ return _fileService.call(request).then((response) {
+ if (_isErrorResponse(response)) {
+ throw _exceptionFromResponse(response,
+ "Cannot create link '$path' to target '$target'");
+ }
return this;
});
}
« no previous file with comments | « sdk/lib/io/file_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698