fix argv[0] discovery.

This commit is contained in:
Vítor Santos Costa
2013-01-13 17:55:13 +00:00
parent ec37045ca3
commit 798afc81c4
16 changed files with 89 additions and 30 deletions

View File

@@ -65,6 +65,18 @@ mydlerror(void)
void
Yap_FindExecutable(char *name)
{
char path[1024];
uint32_t size = sizeof(path);
if (_NSGetExecutablePath(path, &size) == 0) {
char *rc = malloc(size+1);
strncpy(rc, path, size);
return rc;
} else {
char *rc = malloc(size+1);
if (_NSGetExecutablePath(rc, &size) == 0)
return "yap";
return rc;
}
}