Skip to content

Commit

Permalink
FEAT: Linux version of OS_Get_Boot_Path function
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Oct 18, 2021
1 parent 39693bf commit 180dc35
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/os/posix/host-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,9 @@ int pipe2(int pipefd[2], int flags); //to avoid "implicit-function-declaration"
**
***********************************************************************/
{
REBCNT size = 0;
#ifdef TO_OSX
int rv;
REBCNT size = 0;
REBINT rv;
REBCHR *buf;
*path = NULL;
_NSGetExecutablePath(NULL, &size); // get size of the result
Expand All @@ -452,9 +452,15 @@ int pipe2(int pipefd[2], int flags); //to avoid "implicit-function-declaration"
*path = realpath(buf, NULL); // needs FREE once not used!!
}
FREE_MEM(buf);
return TRUE;
#else
// Linux version...
*path = MAKE_STR(PATH_MAX); // needs FREE once not used!!
CLEAR(*path, PATH_MAX*sizeof(REBCHR)); // readlink does not null terminate!
if (readlink("/proc/self/exe", *path, PATH_MAX) == -1) {
return FALSE;
}
#endif
return FALSE;
return TRUE;
}


Expand Down

0 comments on commit 180dc35

Please # to comment.