| Index: runtime/bin/platform_macos.cc
|
| diff --git a/runtime/bin/platform_macos.cc b/runtime/bin/platform_macos.cc
|
| index 55ccd213f87b3e7ec1ea6b3192112cbea22c803c..702bf017806e811b78243ca729276b7c8cdc8872 100644
|
| --- a/runtime/bin/platform_macos.cc
|
| +++ b/runtime/bin/platform_macos.cc
|
| @@ -5,6 +5,8 @@
|
| #include "platform/globals.h"
|
| #if defined(TARGET_OS_MACOS)
|
|
|
| +#include <mach-o/dyld.h>
|
| +
|
| #include "bin/platform.h"
|
|
|
| #include <crt_externs.h> // NOLINT
|
| @@ -75,6 +77,23 @@ void Platform::FreeEnvironment(char** env, intptr_t count) {
|
| delete[] env;
|
| }
|
|
|
| +
|
| +char* Platform::ResolveExecutablePath() {
|
| + // Get the required length of the buffer.
|
| + uint32_t path_size = 0;
|
| + char* path = NULL;
|
| + if (_NSGetExecutablePath(path, &path_size) == 0) {
|
| + return NULL;
|
| + }
|
| + // Allocate buffer and get executable path.
|
| + path = reinterpret_cast<char*>(malloc(path_size));
|
| + if (_NSGetExecutablePath(path, &path_size) != 0) {
|
| + free(path);
|
| + return NULL;
|
| + }
|
| + return path;
|
| +}
|
| +
|
| } // namespace bin
|
| } // namespace dart
|
|
|
|
|