diff --git a/pd/src/s_path.c b/pd/src/s_path.c index 152bd4149381744f0f39e5f93950c89025bb0fe2..321757a5b61c6cc40092e49811066e5e65d08c0d 100644 --- a/pd/src/s_path.c +++ b/pd/src/s_path.c @@ -848,9 +848,10 @@ t_symbol *pd_getdirname(void) buf[len] = '\0'; sys_unbashfilename(buf, buf); #elif defined(__APPLE__) - len = sizeof(buf); - _NSGetExecutablePath(buf, &len); - if (len != -1) buf[len] = '\0'; + int ret; + len = sizeof(buf); buf[0] = '\0'; + ret = _NSGetExecutablePath(buf, &len); + if (ret) len = -1; #elif defined(__FreeBSD__) len = (ssize_t)(readlink("/proc/curproc/file", buf, sizeof(buf)-1)); if (len != -1) buf[len] = '\0';