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

Unified Diff: runtime/bin/file.cc

Issue 14642012: dart:io | Add asynchronous versions of the methods of FileSystemEntity and Link. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments 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 de9d1e92c43943cc5d8943600554cd59d04932c6..5fb1bcdc1b72ddc6688d75ed98cdbda92b8d3376 100644
--- a/runtime/bin/file.cc
+++ b/runtime/bin/file.cc
@@ -1061,8 +1061,8 @@ static CObject* FileCreateLinkRequest(const CObjectArray& request) {
static CObject* FileDeleteLinkRequest(const CObjectArray& request) {
if (request.Length() == 2 && request[1]->IsString()) {
- CObjectString filename(request[1]);
- bool result = File::DeleteLink(filename.CString());
+ CObjectString link_path(request[1]);
+ bool result = File::DeleteLink(link_path.CString());
if (result) {
return CObject::True();
} else {
@@ -1073,6 +1073,22 @@ static CObject* FileDeleteLinkRequest(const CObjectArray& request) {
}
+static CObject* FileLinkTargetRequest(const CObjectArray& request) {
+ if (request.Length() == 2 && request[1]->IsString()) {
+ CObjectString link_path(request[1]);
+ char* target = File::LinkTarget(link_path.CString());
+ if (target != NULL) {
+ CObject* result = new CObjectString(CObject::NewString(target));
+ free(target);
+ return result;
+ } else {
+ return CObject::NewOSError();
+ }
+ }
+ return CObject::IllegalArgumentError();
+}
+
+
static void FileService(Dart_Port dest_port_id,
Dart_Port reply_port_id,
Dart_CObject* message) {
@@ -1145,6 +1161,9 @@ static void FileService(Dart_Port dest_port_id,
case File::kCreateLinkRequest:
response = FileCreateLinkRequest(request);
break;
+ case File::kLinkTargetRequest:
+ response = FileLinkTargetRequest(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