mirror of
https://github.com/cc65/cc65.git
synced 2024-12-24 11:31:31 +00:00
Try reading from /proc/self first on linux, this is needed to make the edgy "make avail" work
This commit is contained in:
parent
6f74a2e9c7
commit
546e82965d
@ -296,10 +296,23 @@ void AddSubSearchPathFromBin (SearchPaths* P, const char* SubDir)
|
||||
}
|
||||
*Ptr = '\0';
|
||||
|
||||
#else
|
||||
#elif defined(__linux__)
|
||||
|
||||
/* reading from proc will return the real location, excluding symlinked
|
||||
pathes - which is needed for certain edgy cases */
|
||||
if (readlink("/proc/self/exe", Dir, sizeof(Dir) - 1) < 0) {
|
||||
GetProgPath(Dir, ArgVec[0]);
|
||||
} else {
|
||||
/* Remove binary name */
|
||||
Ptr = strrchr (Dir, PATHSEP[0]);
|
||||
if (Ptr == 0) {
|
||||
return;
|
||||
}
|
||||
*Ptr = '\0';
|
||||
}
|
||||
|
||||
#else
|
||||
GetProgPath(Dir, ArgVec[0]);
|
||||
#endif
|
||||
|
||||
/* Check for 'bin' directory */
|
||||
|
Loading…
Reference in New Issue
Block a user