| 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 #if !defined(DART_IO_DISABLED) | 5 #if !defined(DART_IO_DISABLED) |
| 6 | 6 |
| 7 #include "bin/platform.h" | 7 #include "bin/platform.h" |
| 8 | 8 |
| 9 #include "bin/file.h" | 9 #include "bin/file.h" |
| 10 #include "bin/utils.h" | 10 #include "bin/utils.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 Dart_SetReturnValue(args, result); | 89 Dart_SetReturnValue(args, result); |
| 90 } | 90 } |
| 91 | 91 |
| 92 | 92 |
| 93 void FUNCTION_NAME(Platform_Environment)(Dart_NativeArguments args) { | 93 void FUNCTION_NAME(Platform_Environment)(Dart_NativeArguments args) { |
| 94 intptr_t count = 0; | 94 intptr_t count = 0; |
| 95 char** env = Platform::Environment(&count); | 95 char** env = Platform::Environment(&count); |
| 96 if (env == NULL) { | 96 if (env == NULL) { |
| 97 OSError error(-1, | 97 OSError error(-1, "Failed to retrieve environment variables.", |
| 98 "Failed to retrieve environment variables.", | |
| 99 OSError::kUnknown); | 98 OSError::kUnknown); |
| 100 Dart_SetReturnValue(args, DartUtils::NewDartOSError(&error)); | 99 Dart_SetReturnValue(args, DartUtils::NewDartOSError(&error)); |
| 101 } else { | 100 } else { |
| 102 Dart_Handle result = Dart_NewList(count); | 101 Dart_Handle result = Dart_NewList(count); |
| 103 if (Dart_IsError(result)) { | 102 if (Dart_IsError(result)) { |
| 104 Dart_PropagateError(result); | 103 Dart_PropagateError(result); |
| 105 } | 104 } |
| 106 intptr_t result_idx = 0; | 105 intptr_t result_idx = 0; |
| 107 for (intptr_t env_idx = 0; env_idx < count; env_idx++) { | 106 for (intptr_t env_idx = 0; env_idx < count; env_idx++) { |
| 108 Dart_Handle str = DartUtils::NewString(env[env_idx]); | 107 Dart_Handle str = DartUtils::NewString(env[env_idx]); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 123 | 122 |
| 124 | 123 |
| 125 void FUNCTION_NAME(Platform_GetVersion)(Dart_NativeArguments args) { | 124 void FUNCTION_NAME(Platform_GetVersion)(Dart_NativeArguments args) { |
| 126 Dart_SetReturnValue(args, Dart_NewStringFromCString(Dart_VersionString())); | 125 Dart_SetReturnValue(args, Dart_NewStringFromCString(Dart_VersionString())); |
| 127 } | 126 } |
| 128 | 127 |
| 129 } // namespace bin | 128 } // namespace bin |
| 130 } // namespace dart | 129 } // namespace dart |
| 131 | 130 |
| 132 #endif // !defined(DART_IO_DISABLED) | 131 #endif // !defined(DART_IO_DISABLED) |
| OLD | NEW |