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

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

Issue 2941873002: [Fuchsia] Fix Platform.executable and Platform.resolvedExecutable (Closed)
Patch Set: Format Created 3 years, 6 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/platform_linux.cc ('k') | runtime/bin/platform_win.cc » ('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 "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(HOST_OS_MACOS) 6 #if defined(HOST_OS_MACOS)
7 7
8 #include "bin/platform.h" 8 #include "bin/platform.h"
9 9
10 #include <CoreFoundation/CoreFoundation.h> 10 #include <CoreFoundation/CoreFoundation.h>
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 char** result; 185 char** result;
186 result = reinterpret_cast<char**>(Dart_ScopeAllocate(i * sizeof(*result))); 186 result = reinterpret_cast<char**>(Dart_ScopeAllocate(i * sizeof(*result)));
187 for (intptr_t current = 0; current < i; current++) { 187 for (intptr_t current = 0; current < i; current++) {
188 result[current] = environ[current]; 188 result[current] = environ[current];
189 } 189 }
190 return result; 190 return result;
191 #endif 191 #endif
192 } 192 }
193 193
194 194
195 const char* Platform::GetExecutableName() {
196 return executable_name_;
197 }
198
199
195 const char* Platform::ResolveExecutablePath() { 200 const char* Platform::ResolveExecutablePath() {
196 // Get the required length of the buffer. 201 // Get the required length of the buffer.
197 uint32_t path_size = 0; 202 uint32_t path_size = 0;
198 if (_NSGetExecutablePath(NULL, &path_size) == 0) { 203 if (_NSGetExecutablePath(NULL, &path_size) == 0) {
199 return NULL; 204 return NULL;
200 } 205 }
201 // Allocate buffer and get executable path. 206 // Allocate buffer and get executable path.
202 char* path = DartUtils::ScopedCString(path_size); 207 char* path = DartUtils::ScopedCString(path_size);
203 if (_NSGetExecutablePath(path, &path_size) != 0) { 208 if (_NSGetExecutablePath(path, &path_size) != 0) {
204 return NULL; 209 return NULL;
205 } 210 }
206 // Return the canonical path as the returned path might contain symlinks. 211 // Return the canonical path as the returned path might contain symlinks.
207 const char* canon_path = File::GetCanonicalPath(path); 212 const char* canon_path = File::GetCanonicalPath(path);
208 return canon_path; 213 return canon_path;
209 } 214 }
210 215
211 216
212 void Platform::Exit(int exit_code) { 217 void Platform::Exit(int exit_code) {
213 exit(exit_code); 218 exit(exit_code);
214 } 219 }
215 220
216 } // namespace bin 221 } // namespace bin
217 } // namespace dart 222 } // namespace dart
218 223
219 #endif // defined(HOST_OS_MACOS) 224 #endif // defined(HOST_OS_MACOS)
OLDNEW
« no previous file with comments | « runtime/bin/platform_linux.cc ('k') | runtime/bin/platform_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698