Permalink
Browse files

Automatic generation of the Components key in the prefpane plist.

git-svn-id: https://svn.perian.org/trunk@248 621663c8-3916-0410-8f58-edc14a8543d5
  • Loading branch information...
gbooker
gbooker committed Jan 6, 2007
1 parent 898af89 commit 82b997015a9f8df1ec0a8d8d1171fb327be581c3
Showing with 287 additions and 1 deletion.
  1. +9 −0 GBPerianPanePListGenerator.h
  2. +58 −0 GBPerianPanePListGenerator.m
  3. +220 −1 Perian.xcodeproj/project.pbxproj
@@ -0,0 +1,9 @@
/*
* GBPerianPanePListGenerator.h
* Perian
*
* Created by Graham Booker on 1/6/07.
* Copyright 2007 Graham Booker. All rights reserved.
*
*/
@@ -0,0 +1,58 @@
/*
* GBPerianPanePListGenerator.c
* Perian
*
* Created by Graham Booker on 1/6/07.
* Copyright 2007 Graham Booker. All rights reserved.
*
*/
#include "GBPerianPanePListGenerator.h"
#import "CPFPerianPrefPaneController.h"
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *filename = [NSString stringWithUTF8String:argv[1]];
NSString *componentDir = [NSString stringWithUTF8String:argv[2]];
NSMutableDictionary *plist = [[NSDictionary dictionaryWithContentsOfFile:filename] mutableCopy];
NSMutableArray *components = [NSMutableArray array];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *types = [NSArray arrayWithObjects:@"QuickTime", @"CoreAudio", @"Frameworks", nil];
NSArray *extensions = [NSArray arrayWithObjects:@"component", @"component", @"framework", nil];
int i;
for(i=0; i<3; i++)
{
NSString *directory = [componentDir stringByAppendingPathComponent:[types objectAtIndex:i]];
NSString *extension = [extensions objectAtIndex:i];
NSEnumerator *dirEnum = [[fileManager directoryContentsAtPath:directory] objectEnumerator];
NSString *candidate = nil;
while((candidate = [dirEnum nextObject]) != nil)
{
if(![[candidate pathExtension] isEqualToString:extension])
continue;
NSString *candidatePath = [directory stringByAppendingPathComponent:candidate];
NSDictionary *info = [[NSBundle bundleWithPath:candidatePath] infoDictionary];
if(info == nil)
continue;
NSDictionary *componentInfo = [NSDictionary dictionaryWithObjectsAndKeys:
[info objectForKey:BundleVersionKey], BundleVersionKey,
candidate, ComponentNameKey,
[[candidate stringByDeletingPathExtension] stringByAppendingPathExtension:@"zip"], ComponentArchiveNameKey,
[NSNumber numberWithInt:i], ComponentTypeKey,
nil];
[components addObject:componentInfo];
}
}
[plist setObject:components forKey:ComponentInfoDictionaryKey];
[plist writeToFile:[NSString stringWithUTF8String:argv[3]] atomically:YES];
[pool release];
return 0;
}
Oops, something went wrong.

0 comments on commit 82b9970

Please sign in to comment.