| Index: runtime/bin/file.cc
|
| diff --git a/runtime/bin/file.cc b/runtime/bin/file.cc
|
| index 5fb1bcdc1b72ddc6688d75ed98cdbda92b8d3376..bc8ca4cbcd4645fb4ee5981c72c37960001acfab 100644
|
| --- a/runtime/bin/file.cc
|
| +++ b/runtime/bin/file.cc
|
| @@ -1089,6 +1089,39 @@ static CObject* FileLinkTargetRequest(const CObjectArray& request) {
|
| }
|
|
|
|
|
| +static CObject* FileTypeRequest(const CObjectArray& request) {
|
| + if (request.Length() == 3 &&
|
| + request[1]->IsString() &&
|
| + request[2]->IsBool()) {
|
| + CObjectString path(request[1]);
|
| + CObjectBool follow_links(request[2]);
|
| + File::Type type = File::GetType(path.CString(), follow_links.Value());
|
| + return new CObjectInt32(CObject::NewInt32(type));
|
| + }
|
| + return CObject::IllegalArgumentError();
|
| +}
|
| +
|
| +
|
| +static CObject* FileIdenticalRequest(const CObjectArray& request) {
|
| + if (request.Length() == 3 &&
|
| + request[1]->IsString() &&
|
| + request[2]->IsString()) {
|
| + CObjectString path1(request[1]);
|
| + CObjectString path2(request[2]);
|
| + File::Identical result = File::AreIdentical(path1.CString(),
|
| + path2.CString());
|
| + if (result == File::kError) {
|
| + return CObject::NewOSError();
|
| + } else if (result == File::kIdentical) {
|
| + return CObject::True();
|
| + } else {
|
| + return CObject::False();
|
| + }
|
| + }
|
| + return CObject::IllegalArgumentError();
|
| +}
|
| +
|
| +
|
| static void FileService(Dart_Port dest_port_id,
|
| Dart_Port reply_port_id,
|
| Dart_CObject* message) {
|
| @@ -1164,6 +1197,12 @@ static void FileService(Dart_Port dest_port_id,
|
| case File::kLinkTargetRequest:
|
| response = FileLinkTargetRequest(request);
|
| break;
|
| + case File::kTypeRequest:
|
| + response = FileTypeRequest(request);
|
| + break;
|
| + case File::kIdenticalRequest:
|
| + response = FileIdenticalRequest(request);
|
| + break;
|
| default:
|
| UNREACHABLE();
|
| }
|
|
|