Re: [AD] [AL] get_executable_name in xsystem.c |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Thu, Apr 06, 2000 at 01:07:49PM +0200, VERSTEEGH@xxxxxx wrote:
> George wrote:
> > run a program by typing "foo", and the executable would be the
> > one in my path, not the random file called `foo' in the current
> > directory.
>
> But this would not be a problem.
> The only way you could execute a program called 'foo' in the current
> directory is when the current directory is first in the path.
>
> (or you could explicitly call ./foo, in which case argv[0] would contain a /)
That's the point -- the modifications were first checking
whether the file named in `argv[0]' exists; if I type `foo' then
this will check for `foo' in the current directory, when the
program which was run would be in some other directory. On
finding `foo', it wouldn't bother checking the /proc entry or
looking elsewhere in the path. That's why I suggested checking
for slashes instead, then doing a path search; or, on Linux,
*always* doing the /proc test, and falling back to the other
methods only if that fails.
George
--
Random project update:
31/03/2000: AllegroGL is now being hosted by SourceForge:
http://AllegroGL.sourceforge.net/