Let GetExecutablePath() return real path on osx. (#325)

This commit is contained in:
scturtle 2018-01-21 12:37:24 +08:00 committed by Fangrui Song
parent b5c9e22ad1
commit 619ad11f9e

View File

@ -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[] = {