source: trunk/Sparkle/SUUpdateDriver.m @ 1046

Revision 259, 1.2 KB checked in by speck, 4 years ago (diff)

Improved updater: now runs without requiring the user to click through all the "Installer.app" dialogs like Windows.

Line 
1//
2//  SUUpdateDriver.m
3//  Sparkle
4//
5//  Created by Andy Matuschak on 5/7/08.
6//  Copyright 2008 Andy Matuschak. All rights reserved.
7//
8
9#import "SUUpdateDriver.h"
10#import "SUUpdater.h"
11
12NSString *SUUpdateDriverFinishedNotification = @"SUUpdateDriverFinished";
13
14@implementation SUUpdateDriver
15- initWithUpdater:(SUUpdater *)anUpdater
16{
17    if ((self = [super init]))
18        updater = anUpdater;
19    return self;
20}
21
22- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], [host bundlePath]]; }
23
24- (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)h
25{
26    appcastURL = [URL copy];
27    host = [h retain];
28}
29
30- (void)abortUpdate
31{
32    [self setValue:[NSNumber numberWithBool:YES] forKey:@"finished"];   
33    [[NSNotificationCenter defaultCenter] postNotificationName:SUUpdateDriverFinishedNotification object:self];
34}
35
36- (BOOL)finished { return finished; }
37
38- (BOOL)installUpdateWithPath:(NSString*)updatePath isPackage:(BOOL)isPackage
39{
40    if ([[updater delegate] respondsToSelector:@selector(updater:installUpdateWithPath:isPackage:)])
41        return [[updater delegate] updater:updater installUpdateWithPath:updatePath isPackage:isPackage];
42    else
43        return NO;
44}
45
46- (void)dealloc
47{
48    [host release];
49    [appcastURL release];
50    [super dealloc];
51}
52
53@end
Note: See TracBrowser for help on using the repository browser.