make NSBundle work, if cwd is not in PATH.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@738 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Andrew McCallum 1996-01-19 16:02:02 +00:00
parent 27dd162bca
commit 283b72b9da

View file

@ -96,6 +96,7 @@ objc_find_executable (const char *file)
{
char *search;
register char *p;
int cwd_in_path = 0;
if (ABSOLUTE_FILENAME_P(file)) {
search = copy_of(file);
@ -122,7 +123,7 @@ objc_find_executable (const char *file)
*next = 0;
if (*p) p++;
if (name[0] == '.' && name[1] == 0)
if (name[0] == '.' && name[1] == 0) {
#ifndef NeXT
getcwd (name, MAXPATHLEN);
#else
@ -132,10 +133,33 @@ objc_find_executable (const char *file)
*/
getwd (name);
#endif
cwd_in_path = 1;
}
strcat (name, "/");
strcat (name, file);
/*
if (access (name, X_OK) == 0)
*/
if (find_full_path (name) == 0)
return copy_of (name);
}
/*
If '.' not in PATH, check this too
*/
if (!cwd_in_path) {
char name[MAXPATHLEN];
#ifndef NeXT
getcwd (name, MAXPATHLEN);
#else
getwd (name);
#endif
strcat (name, "/");
strcat (name, file);
/*
if (access (name, X_OK) == 0)
*/