Try .exe path extensions

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13170 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2002-03-20 13:21:38 +00:00
parent ff4d7e7461
commit ef20cde55c
2 changed files with 31 additions and 2 deletions

View file

@ -12,6 +12,7 @@
getservbyname() doesn't.
* Source/UnixFileHandle.m: Fix to return gdomap port even if
getservbyname() doesn't.
* Source/NSTask.m: Try appending .exe extension to paths under windoze.
2002-03-19 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -737,13 +737,31 @@ pty_slave(const char* name)
full_path = [arch_path stringByAppendingPathComponent: libs];
lpath = [full_path stringByAppendingPathComponent: prog];
#ifdef __MINGW__
if ([mgr isExecutableFileAtPath: lpath] == NO
&& [mgr isExecutableFileAtPath:
(lpath = [lpath stringByAppendingPathExtension: @"exe"])] == NO)
#else
if ([mgr isExecutableFileAtPath: lpath] == NO)
#endif
{
lpath = [arch_path stringByAppendingPathComponent: prog];
#ifdef __MINGW__
if ([mgr isExecutableFileAtPath: lpath] == NO
&& [mgr isExecutableFileAtPath:
(lpath = [lpath stringByAppendingPathExtension: @"exe"])] == NO)
#else
if ([mgr isExecutableFileAtPath: lpath] == NO)
#endif
{
lpath = [base_path stringByAppendingPathComponent: prog];
#ifdef __MINGW__
if ([mgr isExecutableFileAtPath: lpath] == NO
&& [mgr isExecutableFileAtPath:
(lpath = [lpath stringByAppendingPathExtension: @"exe"])] == NO)
#else
if ([mgr isExecutableFileAtPath: lpath] == NO)
#endif
{
/*
* Last resort - if the launch path was simply a program name
@ -754,9 +772,19 @@ pty_slave(const char* name)
{
lpath = [NSBundle _absolutePathOfExecutable: prog];
}
if (lpath != nil && [mgr isExecutableFileAtPath: lpath] == NO)
if (lpath != nil)
{
lpath = nil;
#ifdef __MINGW__
if ([mgr isExecutableFileAtPath: lpath] == NO
&& [mgr isExecutableFileAtPath:
(lpath = [lpath stringByAppendingPathExtension: @"exe"])]
== NO)
#else
if ([mgr isExecutableFileAtPath: lpath] == NO)
#endif
{
lpath = nil;
}
}
}
}