| Index: runtime/bin/directory.cc
|
| diff --git a/runtime/bin/directory.cc b/runtime/bin/directory.cc
|
| index d600f3df935d5fba08910b18008eceb2797c7328..5cb4296a395e510bd1da6038dbbd8466dcf23b74 100644
|
| --- a/runtime/bin/directory.cc
|
| +++ b/runtime/bin/directory.cc
|
| @@ -9,7 +9,6 @@
|
|
|
| static intptr_t GetHandlerPort(Dart_Handle handle) {
|
| if (Dart_IsNull(handle)) {
|
| - // TODO(ager): Generalize this to Directory::kInvalidId.
|
| return 0;
|
| }
|
| return DartUtils::GetIntegerInstanceField(handle, DartUtils::kIdFieldName);
|
| @@ -34,3 +33,41 @@ void FUNCTION_NAME(Directory_List)(Dart_NativeArguments args) {
|
| error_port);
|
| Dart_ExitScope();
|
| }
|
| +
|
| +
|
| +void FUNCTION_NAME(Directory_Exists)(Dart_NativeArguments args) {
|
| + Dart_EnterScope();
|
| + Dart_Handle path = Dart_GetNativeArgument(args, 1);
|
| + ASSERT(Dart_IsString(path));
|
| + Directory::ExistsResult result =
|
| + Directory::Exists(DartUtils::GetStringValue(path));
|
| + int return_value = -1;
|
| + if (result == Directory::EXISTS) {
|
| + return_value = 1;
|
| + }
|
| + if (result == Directory::DOES_NOT_EXIST) {
|
| + return_value = 0;
|
| + }
|
| + Dart_SetReturnValue(args, Dart_NewInteger(return_value));
|
| + Dart_ExitScope();
|
| +}
|
| +
|
| +
|
| +void FUNCTION_NAME(Directory_Create)(Dart_NativeArguments args) {
|
| + Dart_EnterScope();
|
| + Dart_Handle path = Dart_GetNativeArgument(args, 1);
|
| + ASSERT(Dart_IsString(path));
|
| + bool created = Directory::Create(DartUtils::GetStringValue(path));
|
| + Dart_SetReturnValue(args, Dart_NewBoolean(created));
|
| + Dart_ExitScope();
|
| +}
|
| +
|
| +
|
| +void FUNCTION_NAME(Directory_Delete)(Dart_NativeArguments args) {
|
| + Dart_EnterScope();
|
| + Dart_Handle path = Dart_GetNativeArgument(args, 1);
|
| + ASSERT(Dart_IsString(path));
|
| + bool deleted = Directory::Delete(DartUtils::GetStringValue(path));
|
| + Dart_SetReturnValue(args, Dart_NewBoolean(deleted));
|
| + Dart_ExitScope();
|
| +}
|
|
|