| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/platform.h" | 5 #include "bin/platform.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 | 8 |
| 9 #include "bin/file.h" | 9 #include "bin/file.h" |
| 10 #include "bin/utils.h" | 10 #include "bin/utils.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 if (Platform::LocalHostname(hostname, HOSTNAME_LENGTH)) { | 39 if (Platform::LocalHostname(hostname, HOSTNAME_LENGTH)) { |
| 40 Dart_SetReturnValue(args, DartUtils::NewString(hostname)); | 40 Dart_SetReturnValue(args, DartUtils::NewString(hostname)); |
| 41 } else { | 41 } else { |
| 42 Dart_SetReturnValue(args, DartUtils::NewDartOSError()); | 42 Dart_SetReturnValue(args, DartUtils::NewDartOSError()); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 | 46 |
| 47 void FUNCTION_NAME(Platform_ExecutableName)(Dart_NativeArguments args) { | 47 void FUNCTION_NAME(Platform_ExecutableName)(Dart_NativeArguments args) { |
| 48 ASSERT(Platform::GetExecutableName() != NULL); | 48 ASSERT(Platform::GetExecutableName() != NULL); |
| 49 if (Dart_IsRunningPrecompiledCode()) { |
| 50 Dart_ThrowException(Dart_NewStringFromCString( |
| 51 "Platform.executable not supported under precompilation")); |
| 52 UNREACHABLE(); |
| 53 } |
| 49 Dart_SetReturnValue( | 54 Dart_SetReturnValue( |
| 50 args, Dart_NewStringFromCString(Platform::GetExecutableName())); | 55 args, Dart_NewStringFromCString(Platform::GetExecutableName())); |
| 51 } | 56 } |
| 52 | 57 |
| 53 | 58 |
| 54 void FUNCTION_NAME(Platform_ResolvedExecutableName)(Dart_NativeArguments args) { | 59 void FUNCTION_NAME(Platform_ResolvedExecutableName)(Dart_NativeArguments args) { |
| 60 if (Dart_IsRunningPrecompiledCode()) { |
| 61 Dart_ThrowException(Dart_NewStringFromCString( |
| 62 "Platform.resolvedExecutable not supported under precompilation")); |
| 63 UNREACHABLE(); |
| 64 } |
| 65 |
| 55 if (Platform::GetResolvedExecutableName() != NULL) { | 66 if (Platform::GetResolvedExecutableName() != NULL) { |
| 56 Dart_SetReturnValue( | 67 Dart_SetReturnValue( |
| 57 args, Dart_NewStringFromCString(Platform::GetResolvedExecutableName())); | 68 args, Dart_NewStringFromCString(Platform::GetResolvedExecutableName())); |
| 58 } else { | 69 } else { |
| 59 Dart_SetReturnValue(args, Dart_Null()); | 70 Dart_SetReturnValue(args, Dart_Null()); |
| 60 } | 71 } |
| 61 } | 72 } |
| 62 | 73 |
| 63 | 74 |
| 64 void FUNCTION_NAME(Platform_ExecutableArguments)(Dart_NativeArguments args) { | 75 void FUNCTION_NAME(Platform_ExecutableArguments)(Dart_NativeArguments args) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 127 } |
| 117 } | 128 } |
| 118 | 129 |
| 119 | 130 |
| 120 void FUNCTION_NAME(Platform_GetVersion)(Dart_NativeArguments args) { | 131 void FUNCTION_NAME(Platform_GetVersion)(Dart_NativeArguments args) { |
| 121 Dart_SetReturnValue(args, Dart_NewStringFromCString(Dart_VersionString())); | 132 Dart_SetReturnValue(args, Dart_NewStringFromCString(Dart_VersionString())); |
| 122 } | 133 } |
| 123 | 134 |
| 124 } // namespace bin | 135 } // namespace bin |
| 125 } // namespace dart | 136 } // namespace dart |
| OLD | NEW |