From 619ad11f9e03ef7536760150ed4e74f39c3ff0cf Mon Sep 17 00:00:00 2001 From: scturtle Date: Sun, 21 Jan 2018 12:37:24 +0800 Subject: [PATCH] Let `GetExecutablePath()` return real path on osx. (#325) --- src/platform_posix.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/platform_posix.cc b/src/platform_posix.cc index 85b5cb783..ad7d199a9 100644 --- a/src/platform_posix.cc +++ b/src/platform_posix.cc @@ -125,8 +125,10 @@ std::string GetExecutablePath() { _NSGetExecutablePath(nullptr, &size); char* buffer = new char[size]; _NSGetExecutablePath(buffer, &size); - std::string result(buffer); + char* resolved = realpath(buffer, nullptr); + std::string result(resolved); delete[] buffer; + free(resolved); return result; #elif defined(__FreeBSD__) static const int name[] = {