From ef20cde55c0aa64f82bf47b57c5ceaded3232950 Mon Sep 17 00:00:00 2001 From: Richard Frith-Macdonald Date: Wed, 20 Mar 2002 13:21:38 +0000 Subject: [PATCH] Try .exe path extensions git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13170 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 1 + Source/NSTask.m | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 89e2b7a2d..89f19d6a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/Source/NSTask.m b/Source/NSTask.m index 04a5be608..a566d7668 100644 --- a/Source/NSTask.m +++ b/Source/NSTask.m @@ -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; + } } } }