From c72589cba7e4dd6d81ce938c77d9ee16d837a085 Mon Sep 17 00:00:00 2001 From: richard Date: Wed, 3 Jan 2001 15:40:22 +0000 Subject: [PATCH] Minor win32 fix git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@8468 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Headers/gnustep/base/NSObjCRuntime.h | 6 +++--- Source/NSBundle.m | 30 ++++++++++++++++------------ 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7e4c80358..309eafa90 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-01-03 Richard Frith-Macdonald + + * Source/NSBundle.m: fix for checking windows executable file + extensions - reported by michael.scheibler@onevision.de + 2001-01-03 Mirko Viviani * Source/NSObjCRuntime.m (GSInstanceVariableInfo): fixes. diff --git a/Headers/gnustep/base/NSObjCRuntime.h b/Headers/gnustep/base/NSObjCRuntime.h index 07eb92150..a212247d6 100644 --- a/Headers/gnustep/base/NSObjCRuntime.h +++ b/Headers/gnustep/base/NSObjCRuntime.h @@ -59,13 +59,13 @@ GS_EXPORT void NSLogv (NSString* format, va_list args); #ifndef YES #define YES 1 -#endif YES +#endif #ifndef NO #define NO 0 -#endif NO +#endif #ifndef nil #define nil 0 -#endif nil +#endif #define FOUNDATION_EXPORT #define FOUNDATION_STATIC_INLINE static inline diff --git a/Source/NSBundle.m b/Source/NSBundle.m index 7d10c8e5f..69168bd30 100644 --- a/Source/NSBundle.m +++ b/Source/NSBundle.m @@ -1331,19 +1331,23 @@ _bundle_load_callback(Class theClass, Category *theCategory) if ([mgr isExecutableFileAtPath: prefix]) return [prefix stringByStandardizingPath]; #if defined(__WIN32__) - /* Also add common executable extensions on windows */ - if ([path pathExtension] == nil) - { - NSString *wpath; - wpath = [prefix stringByAppendingPathExtension: @"exe"]; - if ([mgr isExecutableFileAtPath: wpath]) - return [wpath stringByStandardizingPath]; - wpath = [prefix stringByAppendingPathExtension: @"com"]; - if ([mgr isExecutableFileAtPath: wpath]) - return [wpath stringByStandardizingPath]; - wpath = [prefix stringByAppendingPathExtension: @"cmd"]; - if ([mgr isExecutableFileAtPath: wpath]) - return [wpath stringByStandardizingPath]; + { + NSString *ext = [path pathExtension]; + + /* Also add common executable extensions on windows */ + if (ext == nil || [ext length] == 0) + { + NSString *wpath; + wpath = [prefix stringByAppendingPathExtension: @"exe"]; + if ([mgr isExecutableFileAtPath: wpath]) + return [wpath stringByStandardizingPath]; + wpath = [prefix stringByAppendingPathExtension: @"com"]; + if ([mgr isExecutableFileAtPath: wpath]) + return [wpath stringByStandardizingPath]; + wpath = [prefix stringByAppendingPathExtension: @"cmd"]; + if ([mgr isExecutableFileAtPath: wpath]) + return [wpath stringByStandardizingPath]; + } } #endif }