Add macOS to some Linux/Android-only-isms
This commit is contained in:
@ -1389,10 +1389,10 @@ std::string GetProgramPath()
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
int curSize = PATH_MAX;
|
||||
char* buffer = static_cast<char*>(std::realloc(nullptr, curSize + 1));
|
||||
char* buffer = static_cast<char*>(std::realloc(nullptr, curSize));
|
||||
for (;;)
|
||||
{
|
||||
uint32 nChars = PATH_MAX - 1;
|
||||
uint32 nChars = curSize - 1;
|
||||
int res = _NSGetExecutablePath(buffer, &nChars);
|
||||
if (res == 0)
|
||||
{
|
||||
@ -1410,12 +1410,6 @@ std::string GetProgramPath()
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (curSize >= 1048576)
|
||||
{
|
||||
std::free(buffer);
|
||||
return {};
|
||||
}
|
||||
|
||||
curSize *= 2;
|
||||
buffer = static_cast<char*>(std::realloc(buffer, curSize + 1));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user