Changeset 247
- Timestamp:
- 01/06/07 11:11:51 (2 years ago)
- Files:
-
- trunk/CPFPerianPrefPaneController.h (modified) (2 diffs)
- trunk/CPFPerianPrefPaneController.m (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/CPFPerianPrefPaneController.h
r236 r247 3 3 #import <Cocoa/Cocoa.h> 4 4 #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" 5 11 6 12 typedef enum … … 14 20 { 15 21 ComponentTypeQuickTime, 16 ComponentTypeCoreAudio 22 ComponentTypeCoreAudio, 23 ComponentTypeFramework 17 24 } ComponentType; 18 25 trunk/CPFPerianPrefPaneController.m
r246 r247 2 2 #import <Security/Security.h> 3 3 #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"10 4 11 5 #define AC3DynamicRangeKey CFSTR("dynamicRange") … … 70 64 } 71 65 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 72 78 - (InstallStatus)installStatusForComponent:(NSString *)component type:(ComponentType)type withMyVersion:(NSString *)myVersion 73 79 { … … 82 88 path = [self quickTimeComponentDir]; 83 89 break; 90 case ComponentTypeFramework: 91 path = [self frameworkComponentDir]; 92 break; 84 93 } 85 94 path = [path stringByAppendingPathComponent:component]; 86 95 87 NS Bundle *bundle = [NSBundle bundleWithPath:path];88 if( bundle== nil)96 NSDictionary *infoDict = [NSDictionary dictionaryWithContentsOfFile:[path stringByAppendingPathComponent:@"Contents/Info.plist"]]; 97 if(infoDict == nil) 89 98 return InstallStatusNotInstalled; 90 99 91 NSString *currentVersion = [ [bundle infoDictionary]objectForKey:BundleVersionKey];100 NSString *currentVersion = [infoDict objectForKey:BundleVersionKey]; 92 101 if([currentVersion compare:myVersion] == NSOrderedAscending) 93 102 return InstallStatusOutdated; … … 162 171 } 163 172 164 } 173 } 165 174 } 166 175 … … 304 313 containingDir = [self quickTimeComponentDir]; 305 314 break; 315 case ComponentTypeFramework: 316 containingDir = [self frameworkComponentDir]; 317 break; 306 318 } 307 319 InstallStatus pieceStatus = [self installStatusForComponent:component type:type withMyVersion:myVersion]; … … 342 354 NSString *coreAudioComponentPath = [componentPath stringByAppendingPathComponent:@"CoreAudio"]; 343 355 NSString *quickTimeComponentPath = [componentPath stringByAppendingPathComponent:@"QuickTime"]; 356 NSString *frameworkComponentPath = [componentPath stringByAppendingPathComponent:@"Frameworks"]; 344 357 AuthorizationRef auth = nil; 345 358 … … 366 379 case ComponentTypeQuickTime: 367 380 archivePath = [quickTimeComponentPath stringByAppendingPathComponent:[myComponent objectForKey:ComponentArchiveNameKey]]; 381 break; 382 case ComponentTypeFramework: 383 archivePath = [frameworkComponentPath stringByAppendingPathComponent:[myComponent objectForKey:ComponentArchiveNameKey]]; 368 384 break; 369 385 } … … 407 423 directory = [self quickTimeComponentDir]; 408 424 break; 425 case ComponentTypeFramework: 426 directory = [self frameworkComponentDir]; 427 break; 409 428 } 410 BOOLresult = [[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]; 411 430 } 412 431 if(auth != nil)
