From 50c0aa3ed4e58e9273182db64211766d7475a635 Mon Sep 17 00:00:00 2001 From: mccallum Date: Fri, 19 Jan 1996 16:02:02 +0000 Subject: [PATCH] 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 --- Source/find_exec.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/Source/find_exec.c b/Source/find_exec.c index ed9475544..8a399afe4 100644 --- a/Source/find_exec.c +++ b/Source/find_exec.c @@ -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) */