In Mac OS X, app execuatables are not in MyApp.app/MyApp, so this now checks

to see if MpApp.app/Contents/MacOS/MyApp exists, and uses that.

Actually, it also handles the OmniWeb hack where the real executable
is MyApp.app/Contents/MacOS/.MyApp.  (But it still won't find the
frameworks that are stored in the app wrapper.)
This commit is contained in:
Steve Nygard 2000-10-15 02:47:20 +00:00
parent d02e83b75d
commit d62f2dd86f

View File

@ -1,5 +1,5 @@
//
// $Id: MappedFile.m,v 1.6 2000/10/15 01:22:16 nygard Exp $
// $Id: MappedFile.m,v 1.7 2000/10/15 02:47:20 nygard Exp $
//
//
@ -209,21 +209,32 @@ static NSMutableArray *secondSearchPath = nil;
- (NSString *) pathToMainFileOfWrapper:(NSString *)path
{
NSRange range;
NSMutableString *tmp;
NSString *extension;
NSString *base;
NSString *base, *extension, *mainFile;
base = [[path pathComponents] lastObject];
NSAssert (base != nil, @"No base.");
base = [path lastPathComponent];
extension = [base pathExtension];
base = [base stringByDeletingPathExtension];
mainFile = [NSString stringWithFormat:@"%@/%@", path, base];
if ([@"app" isEqual:extension] == YES)
{
NSFileManager *fileManager;
NSString *alternateMainFile;
extension = [NSString stringWithFormat:@".%@", [base pathExtension]];
fileManager = [NSFileManager defaultManager];
// Currently OmniWeb uses a small file to change the library paths and then runs the real
// OmniWeb, which is in Contents/MacOS/.OmniWeb, so we'll check for this case first:
alternateMainFile = [NSString stringWithFormat:@"%@/Contents/MacOS/.%@", path, base];
if ([fileManager fileExistsAtPath:alternateMainFile] == YES)
mainFile = alternateMainFile;
else {
// Mac OS X has a different app layout now
alternateMainFile = [NSString stringWithFormat:@"%@/Contents/MacOS/%@", path, base];
if ([fileManager fileExistsAtPath:alternateMainFile] == YES)
mainFile = alternateMainFile;
}
}
tmp = [NSMutableString stringWithFormat:@"%@/%@", path, base];
range = [tmp rangeOfString:extension options:NSBackwardsSearch];
[tmp deleteCharactersInRange:range];
return tmp;
return mainFile;
}
- (NSString *) adjustedFrameworkPath:(NSString *)path