Changeset 247

Show
Ignore:
Timestamp:
01/06/07 11:11:51 (2 years ago)
Author:
gbooker
Message:
  • NSBundles cache, so don't use them anymore.
  • Added Framework Type
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/CPFPerianPrefPaneController.h

    r236 r247  
    33#import <Cocoa/Cocoa.h> 
    44#import <PreferencePanes/NSPreferencePane.h> 
     5 
     6#define ComponentInfoDictionaryKey      @"Components" 
     7#define BundleVersionKey @"CFBundleVersion" 
     8#define ComponentNameKey @"Name" 
     9#define ComponentArchiveNameKey @"ArchiveName" 
     10#define ComponentTypeKey @"Type" 
    511 
    612typedef enum 
     
    1420{ 
    1521        ComponentTypeQuickTime, 
    16         ComponentTypeCoreAudio 
     22        ComponentTypeCoreAudio, 
     23        ComponentTypeFramework 
    1724} ComponentType; 
    1825 
  • trunk/CPFPerianPrefPaneController.m

    r246 r247  
    22#import <Security/Security.h> 
    33#include <sys/stat.h> 
    4  
    5 #define ComponentInfoDictionaryKey      @"Components" 
    6 #define BundleVersionKey @"CFBundleVersion" 
    7 #define ComponentNameKey @"Name" 
    8 #define ComponentArchiveNameKey @"ArchiveName" 
    9 #define ComponentTypeKey @"Type" 
    104 
    115#define AC3DynamicRangeKey CFSTR("dynamicRange") 
     
    7064} 
    7165 
     66- (NSString *)frameworkComponentDir 
     67{ 
     68        NSString *basePath = nil; 
     69         
     70        if(![self systemInstalled]) 
     71                basePath = NSHomeDirectory(); 
     72        else 
     73                basePath = [NSString stringWithString:@"/"]; 
     74         
     75        return [basePath stringByAppendingPathComponent:@"Library/Frameworks"]; 
     76} 
     77 
    7278- (InstallStatus)installStatusForComponent:(NSString *)component type:(ComponentType)type withMyVersion:(NSString *)myVersion 
    7379{ 
     
    8288                        path = [self quickTimeComponentDir]; 
    8389                        break; 
     90                case ComponentTypeFramework: 
     91                        path = [self frameworkComponentDir]; 
     92                        break; 
    8493        } 
    8594        path = [path stringByAppendingPathComponent:component]; 
    8695         
    87         NSBundle *bundle = [NSBundle bundleWithPath:path]; 
    88         if(bundle == nil) 
     96        NSDictionary *infoDict = [NSDictionary dictionaryWithContentsOfFile:[path stringByAppendingPathComponent:@"Contents/Info.plist"]]; 
     97        if(infoDict == nil) 
    8998                return InstallStatusNotInstalled; 
    9099         
    91         NSString *currentVersion = [[bundle infoDictionary] objectForKey:BundleVersionKey]; 
     100        NSString *currentVersion = [infoDict objectForKey:BundleVersionKey]; 
    92101        if([currentVersion compare:myVersion] == NSOrderedAscending) 
    93102                return InstallStatusOutdated; 
     
    162171                } 
    163172                 
    164         }       
     173        } 
    165174} 
    166175 
     
    304313                        containingDir = [self quickTimeComponentDir]; 
    305314                        break; 
     315                case ComponentTypeFramework: 
     316                        containingDir = [self frameworkComponentDir]; 
     317                        break; 
    306318        } 
    307319        InstallStatus pieceStatus = [self installStatusForComponent:component type:type withMyVersion:myVersion]; 
     
    342354        NSString *coreAudioComponentPath = [componentPath stringByAppendingPathComponent:@"CoreAudio"]; 
    343355        NSString *quickTimeComponentPath = [componentPath stringByAppendingPathComponent:@"QuickTime"]; 
     356        NSString *frameworkComponentPath = [componentPath stringByAppendingPathComponent:@"Frameworks"]; 
    344357        AuthorizationRef auth = nil; 
    345358         
     
    366379                        case ComponentTypeQuickTime: 
    367380                                archivePath = [quickTimeComponentPath stringByAppendingPathComponent:[myComponent objectForKey:ComponentArchiveNameKey]]; 
     381                                break; 
     382                        case ComponentTypeFramework: 
     383                                archivePath = [frameworkComponentPath stringByAppendingPathComponent:[myComponent objectForKey:ComponentArchiveNameKey]]; 
    368384                                break; 
    369385                } 
     
    407423                                directory = [self quickTimeComponentDir]; 
    408424                                break; 
     425                        case ComponentTypeFramework: 
     426                                directory = [self frameworkComponentDir]; 
     427                                break; 
    409428                } 
    410                 BOOL result = [[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation source:directory destination:@"" files:[myComponent objectForKey:ComponentNameKey] tag:&tag]; 
     429                result = [[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation source:directory destination:@"" files:[myComponent objectForKey:ComponentNameKey] tag:&tag]; 
    411430        } 
    412431        if(auth != nil)