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

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

Issue 1160793004: Resolve the executable path on Mac OS when sym-linked (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Addressed review comments Created 5 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 | « no previous file | tests/standalone/standalone.status » ('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(TARGET_OS_MACOS) 6 #if defined(TARGET_OS_MACOS)
7 7
8 #include <mach-o/dyld.h> 8 #include <mach-o/dyld.h>
9 9
10 #include "bin/file.h"
10 #include "bin/platform.h" 11 #include "bin/platform.h"
11 12
12 #include <crt_externs.h> // NOLINT 13 #include <crt_externs.h> // NOLINT
13 #include <signal.h> // NOLINT 14 #include <signal.h> // NOLINT
14 #include <string.h> // NOLINT 15 #include <string.h> // NOLINT
15 #include <unistd.h> // NOLINT 16 #include <unistd.h> // NOLINT
16 17
17 #include "bin/fdutils.h" 18 #include "bin/fdutils.h"
18 19
19 20
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 char* path = NULL; 85 char* path = NULL;
85 if (_NSGetExecutablePath(path, &path_size) == 0) { 86 if (_NSGetExecutablePath(path, &path_size) == 0) {
86 return NULL; 87 return NULL;
87 } 88 }
88 // Allocate buffer and get executable path. 89 // Allocate buffer and get executable path.
89 path = reinterpret_cast<char*>(malloc(path_size)); 90 path = reinterpret_cast<char*>(malloc(path_size));
90 if (_NSGetExecutablePath(path, &path_size) != 0) { 91 if (_NSGetExecutablePath(path, &path_size) != 0) {
91 free(path); 92 free(path);
92 return NULL; 93 return NULL;
93 } 94 }
94 return path; 95 // Return the canonical path as the returned path might contain symlinks.
96 char* canon_path = File::GetCanonicalPath(path);
97 free(path);
98 return canon_path;
95 } 99 }
96 100
97 } // namespace bin 101 } // namespace bin
98 } // namespace dart 102 } // namespace dart
99 103
100 #endif // defined(TARGET_OS_MACOS) 104 #endif // defined(TARGET_OS_MACOS)
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/standalone.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698