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

Unified Diff: runtime/bin/file.cc

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 | « runtime/bin/file.h ('k') | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file.cc
diff --git a/runtime/bin/file.cc b/runtime/bin/file.cc
index 70833d11063a608da41e589ecc8b0927d1d7a8d8..f04a36796801de3ff497124e4797299c2b3d3ac7 100644
--- a/runtime/bin/file.cc
+++ b/runtime/bin/file.cc
@@ -1013,6 +1013,22 @@ static CObject* FileWriteListRequest(const CObjectArray& request) {
}
+static CObject* FileCreateLinkRequest(const CObjectArray& request) {
+ if (request.Length() != 3 ||
+ !request[1]->IsString() ||
+ !request[2]->IsString()) {
+ return CObject::IllegalArgumentError();
+ }
+ CObjectString link_name(request[1]);
+ CObjectString target_name(request[2]);
+ if (File::CreateLink(link_name.CString(), target_name.CString())) {
+ return CObject::True();
+ } else {
+ return CObject::NewOSError();
+ }
+}
+
+
static CObject* FileDeleteLinkRequest(const CObjectArray& request) {
if (request.Length() == 2 && request[1]->IsString()) {
CObjectString filename(request[1]);
@@ -1023,7 +1039,7 @@ static CObject* FileDeleteLinkRequest(const CObjectArray& request) {
return CObject::NewOSError();
}
}
- return CObject::False();
+ return CObject::IllegalArgumentError();
}
@@ -1096,6 +1112,9 @@ static void FileService(Dart_Port dest_port_id,
case File::kDeleteLinkRequest:
response = FileDeleteLinkRequest(request);
break;
+ case File::kCreateLinkRequest:
+ response = FileCreateLinkRequest(request);
+ break;
default:
UNREACHABLE();
}
« no previous file with comments | « runtime/bin/file.h ('k') | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698