diff --git a/src/common/impl/FFPlatform_unix.c b/src/common/impl/FFPlatform_unix.c index 8e590dd34..c93c863bd 100644 --- a/src/common/impl/FFPlatform_unix.c +++ b/src/common/impl/FFPlatform_unix.c @@ -12,7 +12,7 @@ #include #ifdef __APPLE__ - #include + #include #include #elif defined(__FreeBSD__) || defined(__NetBSD__) #include @@ -33,7 +33,11 @@ static void getExePath(FFPlatform* platform) if (exePathLen >= 0) exePath[exePathLen] = '\0'; #elif defined(__APPLE__) - int exePathLen = proc_pidpath((pid_t) platform->pid, exePath, sizeof(exePath)); + uint32_t exePathLen = sizeof(exePath); + if (_NSGetExecutablePath(exePath, &exePathLen) == 0) + exePathLen = (uint32_t) strlen(exePath); + else + exePathLen = 0; #elif defined(__FreeBSD__) || defined(__NetBSD__) size_t exePathLen = sizeof(exePath); if(sysctl(