Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1263)

Side by Side Diff: runtime/bin/platform.cc

Issue 1307183002: Add access to the isolate package-root/package-map in Platform. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: replace packageRoot getter, remove C++ imp. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/bin/io_natives.cc ('k') | runtime/bin/platform_patch.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 Dart_Handle str = DartUtils::NewString(argv[i]); 69 Dart_Handle str = DartUtils::NewString(argv[i]);
70 Dart_Handle error = Dart_ListSetAt(result, i - 1, str); 70 Dart_Handle error = Dart_ListSetAt(result, i - 1, str);
71 if (Dart_IsError(error)) { 71 if (Dart_IsError(error)) {
72 Dart_PropagateError(error); 72 Dart_PropagateError(error);
73 } 73 }
74 } 74 }
75 Dart_SetReturnValue(args, result); 75 Dart_SetReturnValue(args, result);
76 } 76 }
77 77
78 78
79 void FUNCTION_NAME(Platform_PackageRoot)(Dart_NativeArguments args) {
80 const char* package_root = Platform::GetPackageRoot();
81 if (package_root == NULL) {
82 package_root = "";
83 }
84 Dart_SetReturnValue(args, Dart_NewStringFromCString(package_root));
85 }
86
87
88 void FUNCTION_NAME(Platform_Environment)(Dart_NativeArguments args) { 79 void FUNCTION_NAME(Platform_Environment)(Dart_NativeArguments args) {
89 intptr_t count = 0; 80 intptr_t count = 0;
90 char** env = Platform::Environment(&count); 81 char** env = Platform::Environment(&count);
91 if (env == NULL) { 82 if (env == NULL) {
92 OSError error(-1, 83 OSError error(-1,
93 "Failed to retrieve environment variables.", 84 "Failed to retrieve environment variables.",
94 OSError::kUnknown); 85 OSError::kUnknown);
95 Dart_SetReturnValue(args, DartUtils::NewDartOSError(&error)); 86 Dart_SetReturnValue(args, DartUtils::NewDartOSError(&error));
96 } else { 87 } else {
97 Dart_Handle result = Dart_NewList(count); 88 Dart_Handle result = Dart_NewList(count);
(...skipping 18 matching lines...) Expand all
116 } 107 }
117 } 108 }
118 109
119 110
120 void FUNCTION_NAME(Platform_GetVersion)(Dart_NativeArguments args) { 111 void FUNCTION_NAME(Platform_GetVersion)(Dart_NativeArguments args) {
121 Dart_SetReturnValue(args, Dart_NewStringFromCString(Dart_VersionString())); 112 Dart_SetReturnValue(args, Dart_NewStringFromCString(Dart_VersionString()));
122 } 113 }
123 114
124 } // namespace bin 115 } // namespace bin
125 } // namespace dart 116 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/io_natives.cc ('k') | runtime/bin/platform_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698