Revision: 4176
Updated Code
at February 14, 2008 04:50 by 0xced
Updated Code
- (id)initWithBundle:(NSBundle *)bundle
{
if ([[self class] version] != 0) {
NSString *reloadPath = [bundle pathForResource:@"reload" ofType:nil];
[NSTask launchedTaskWithLaunchPath:reloadPath arguments:[NSArray arrayWithObjects:[bundle bundleIdentifier],
[NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]], nil]];
[NSApp terminate:self];
}
[[self class] setVersion:1];
if ((self = [super initWithBundle:bundle]) != nil) {
// initializations
}
return self;
}
Revision: 4175
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 31, 2007 16:48 by 0xced
Initial Code
- (id)initWithBundle:(NSBundle *)bundle
{
NSDictionary *infoPlist = [NSDictionary dictionaryWithContentsOfFile:[[[bundle bundlePath] stringByAppendingPathComponent:@"Contents"] stringByAppendingPathComponent:@"Info.plist"]];
NSString *onDiskVersion = [infoPlist objectForKey:@"CFBundleShortVersionString"];
NSString *cachedVersion = [[bundle infoDictionary] objectForKey:@"CFBundleShortVersionString"];
if (![onDiskVersion isEqualToString:cachedVersion]) {
NSString *reloadPath = [[[bundle executablePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"reload"];
[NSTask launchedTaskWithLaunchPath:reloadPath arguments:[NSArray arrayWithObjects:[bundle bundleIdentifier],
[NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]], nil]];
[NSApp terminate:self];
}
if ((self = [super initWithBundle:bundle]) != nil) {
// initializations
}
return self;
}
Initial URL
Initial Description
This detects if a preference pane is loaded over an already loaded older version. If the version mismatches, the reload tool (http://snipplr.com/view/3924/reload-a-preference-pane/) is launched and System Preferences is quitted.
Initial Title
Detect already loaded older version of a preference pane
Initial Tags
Initial Language
Objective C