mirror of
https://github.com/darlinghq/class-dump.git
synced 2025-02-17 10:27:34 +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
|
- (NSString *) pathToMainFileOfWrapper:(NSString *)path
|
||||||
{
|
{
|
||||||
NSRange range;
|
NSString *base, *extension, *mainFile;
|
||||||
NSMutableString *tmp;
|
|
||||||
NSString *extension;
|
|
||||||
NSString *base;
|
|
||||||
|
|
||||||
base = [[path pathComponents] lastObject];
|
base = [path lastPathComponent];
|
||||||
NSAssert (base != nil, @"No base.");
|
extension = [base pathExtension];
|
||||||
|
base = [base stringByDeletingPathExtension];
|
||||||
extension = [NSString stringWithFormat:@".%@", [base pathExtension]];
|
mainFile = [NSString stringWithFormat:@"%@/%@", path, base];
|
||||||
|
if ([@"app" isEqual:extension] == YES)
|
||||||
|
{
|
||||||
|
NSFileManager *fileManager;
|
||||||
|
NSString *alternateMainFile;
|
||||||
|
|
||||||
tmp = [NSMutableString stringWithFormat:@"%@/%@", path, base];
|
fileManager = [NSFileManager defaultManager];
|
||||||
range = [tmp rangeOfString:extension options:NSBackwardsSearch];
|
// Currently OmniWeb uses a small file to change the library paths and then runs the real
|
||||||
[tmp deleteCharactersInRange:range];
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return tmp;
|
return mainFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) adjustedFrameworkPath:(NSString *)path
|
- (NSString *) adjustedFrameworkPath:(NSString *)path
|
||||||
|
Loading…
x
Reference in New Issue
Block a user