OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "bin/dartutils.h" | 5 #include "bin/dartutils.h" |
6 #include "bin/directory.h" | 6 #include "bin/directory.h" |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 | 9 |
10 static intptr_t GetHandlerPort(Dart_Handle handle) { | 10 static intptr_t GetHandlerPort(Dart_Handle handle) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 if (Dart_IsString(path)) { | 69 if (Dart_IsString(path)) { |
70 bool created = Directory::Create(DartUtils::GetStringValue(path)); | 70 bool created = Directory::Create(DartUtils::GetStringValue(path)); |
71 Dart_SetReturnValue(args, Dart_NewBoolean(created)); | 71 Dart_SetReturnValue(args, Dart_NewBoolean(created)); |
72 } else { | 72 } else { |
73 Dart_SetReturnValue(args, Dart_NewBoolean(false)); | 73 Dart_SetReturnValue(args, Dart_NewBoolean(false)); |
74 } | 74 } |
75 Dart_ExitScope(); | 75 Dart_ExitScope(); |
76 } | 76 } |
77 | 77 |
78 | 78 |
| 79 void FUNCTION_NAME(Directory_CreateTemp)(Dart_NativeArguments args) { |
| 80 Dart_EnterScope(); |
| 81 Dart_Handle path = Dart_GetNativeArgument(args, 1); |
| 82 Dart_Handle number = Dart_GetNativeArgument(args, 2); |
| 83 if (Dart_IsString(path) && Dart_IsInteger(number)) { |
| 84 char* result = Directory::CreateTemp(DartUtils::GetStringValue(path), |
| 85 DartUtils::GetIntegerValue(number)); |
| 86 Dart_SetReturnValue(args, Dart_NewString(result)); |
| 87 free(result); |
| 88 } else { |
| 89 Dart_SetReturnValue(args, Dart_NewString("")); |
| 90 } |
| 91 Dart_ExitScope(); |
| 92 } |
| 93 |
| 94 |
79 void FUNCTION_NAME(Directory_Delete)(Dart_NativeArguments args) { | 95 void FUNCTION_NAME(Directory_Delete)(Dart_NativeArguments args) { |
80 Dart_EnterScope(); | 96 Dart_EnterScope(); |
81 Dart_Handle path = Dart_GetNativeArgument(args, 1); | 97 Dart_Handle path = Dart_GetNativeArgument(args, 1); |
82 if (Dart_IsString(path)) { | 98 if (Dart_IsString(path)) { |
83 bool deleted = Directory::Delete(DartUtils::GetStringValue(path)); | 99 bool deleted = Directory::Delete(DartUtils::GetStringValue(path)); |
84 Dart_SetReturnValue(args, Dart_NewBoolean(deleted)); | 100 Dart_SetReturnValue(args, Dart_NewBoolean(deleted)); |
85 } else { | 101 } else { |
86 Dart_SetReturnValue(args, Dart_NewBoolean(false)); | 102 Dart_SetReturnValue(args, Dart_NewBoolean(false)); |
87 } | 103 } |
88 Dart_ExitScope(); | 104 Dart_ExitScope(); |
89 } | 105 } |
OLD | NEW |