mirror of
https://github.com/darlinghq/class-dump.git
synced 2024-11-23 12:29:43 +00:00
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:
parent
d02e83b75d
commit
d62f2dd86f
37
MappedFile.m
37
MappedFile.m
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user