diff --git a/SUUpdatePermissionPrompt.h b/SUUpdatePermissionPrompt.h index 3c01c2ec..7649ac46 100644 --- a/SUUpdatePermissionPrompt.h +++ b/SUUpdatePermissionPrompt.h @@ -11,7 +11,7 @@ #import "Sparkle.h" -@interface SUUpdatePermissionPrompt : NSWindowController { +@interface SUUpdatePermissionPrompt : SUWindowController { } diff --git a/SUWindowController.h b/SUWindowController.h new file mode 100644 index 00000000..bb96c72f --- /dev/null +++ b/SUWindowController.h @@ -0,0 +1,19 @@ +// +// SUWindowController.h +// Sparkle +// +// Created by Andy Matuschak on 2/13/08. +// Copyright 2008 Andy Matuschak. All rights reserved. +// + +#ifndef SUWINDOWCONTROLLER_H +#define SUWINDOWCONTROLLER_H + +#import + +@interface SUWindowController : NSWindowController { } +// We use this instead of plain old NSWindowController initWithWindowNibName so that we'll be able to find the right path when running in a bundle loaded from another app. +- (id)initWithHostBundle:(NSBundle *)hb windowNibName:(NSString *)nibName; +@end + +#endif \ No newline at end of file diff --git a/SUWindowController.m b/SUWindowController.m new file mode 100644 index 00000000..f73ef80d --- /dev/null +++ b/SUWindowController.m @@ -0,0 +1,25 @@ +// +// SUWindowController.m +// Sparkle +// +// Created by Andy Matuschak on 2/13/08. +// Copyright 2008 Andy Matuschak. All rights reserved. +// + +#import "SUWindowController.h" + +@implementation SUWindowController + +- (id)initWithHostBundle:(NSBundle *)hb windowNibName:(NSString *)nibName +{ + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:nibName ofType:@"nib"]; + if (path == nil) // Slight hack to resolve issues with running Sparkle in debug configurations. + { + NSString *frameworkPath = [[hb sharedFrameworksPath] stringByAppendingPathComponent:@"Sparkle.framework"]; + NSBundle *framework = [NSBundle bundleWithPath:frameworkPath]; + path = [framework pathForResource:nibName ofType:@"nib"]; + } + return [super initWithWindowNibPath:path owner:self]; +} + +@end