fix for bundle loading on wndows when we don't have the dll path extension

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28292 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2009-05-22 17:16:24 +00:00
parent 59851c2ad3
commit a2348e55ae
2 changed files with 23 additions and 2 deletions

View file

@ -320,7 +320,7 @@ bundle_object_name(NSString *path, NSString* executable)
path = [path stringByAppendingPathComponent: gnustep_target_dir];
path1 = [path stringByAppendingPathComponent: name];
path = [path stringByAppendingPathComponent: library_combo];
path2 = [path stringByAppendingPathComponent: executable];
path2 = [path stringByAppendingPathComponent: name];
if ([mgr isReadableFileAtPath: path2] == YES)
return path2;
@ -328,7 +328,24 @@ bundle_object_name(NSString *path, NSString* executable)
return path1;
else if ([mgr isReadableFileAtPath: path0] == YES)
return path0;
return path2;
#if defined(__MINGW32__)
/* If we couldn't find the binary, and we are on windows, and the name
* has no path extension, then let's try looking for a dll.
*/
if ([name pathExtension] == nil)
{
if ([mgr isReadableFileAtPath:
[path2 stringByAppendingPathExtension: @"dll"]] == YES)
return [path2 stringByAppendingPathExtension: @"dll"];
else if ([mgr isReadableFileAtPath:
[path1 stringByAppendingPathExtension: @"dll"]] == YES)
return [path1 stringByAppendingPathExtension: @"dll"];
else if ([mgr isReadableFileAtPath:
[path0 stringByAppendingPathExtension: @"dll"]] == YES)
return [path0 stringByAppendingPathExtension: @"dll"];
}
#endif
return path0;
}
/* Construct a path from components */

View file

@ -2021,6 +2021,10 @@ static NSStringEncoding defaultEncoding;
#if defined(__MINGW32__)
- (const GSNativeChar*) fileSystemRepresentationWithPath: (NSString*)path
{
if (path != nil && [path rangeOfString: @"/"].length > 0)
{
path = [path stringByReplacingString: @"/" withString: @"\\"];
}
return
(const GSNativeChar*)[path cStringUsingEncoding: NSUnicodeStringEncoding];
}