| 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();
|
| }
|
|
|