mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
I added an application target but it's really intended to be used as a command line tool. The reason being was that it was the easiest way to bundle the Sparkle framework, I've found. Note this doesn't work perfectly yet, but it's a good start. Trying to update anything that's not Sparkle based will crash for instance. And it will use the installer progress tool which may be undesirable.
52 lines
1.2 KiB
Objective-C
52 lines
1.2 KiB
Objective-C
//
|
|
// AppDelegate.m
|
|
// sparkle-cli
|
|
//
|
|
// Created by Mayur Pawashe on 4/10/16.
|
|
// Copyright © 2016 Sparkle Project. All rights reserved.
|
|
//
|
|
|
|
#import "AppDelegate.h"
|
|
#import <Sparkle/Sparkle.h>
|
|
#import "SUCommandLineUserDriver.h"
|
|
|
|
@interface AppDelegate ()
|
|
|
|
@property (nonatomic, readonly) NSBundle *bundle;
|
|
@property (nonatomic) SUUpdater *updater;
|
|
|
|
@end
|
|
|
|
@implementation AppDelegate
|
|
|
|
@synthesize bundle = _bundle;
|
|
@synthesize updater = _updater;
|
|
|
|
- (instancetype)initWithBundlePath:(const char *)bundlePath
|
|
{
|
|
self = [super init];
|
|
if (self != nil) {
|
|
NSString *bundlePathString = [[NSString alloc] initWithUTF8String:bundlePath];
|
|
if (bundlePathString == nil) {
|
|
return nil;
|
|
}
|
|
|
|
NSBundle *bundle = [NSBundle bundleWithPath:bundlePathString];
|
|
if (bundle == nil) {
|
|
return nil;
|
|
}
|
|
|
|
_bundle = bundle;
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)applicationDidFinishLaunching:(NSNotification *)__unused aNotification
|
|
{
|
|
id <SUUserDriver> userDriver = [[SUCommandLineUserDriver alloc] initWithBundle:self.bundle];
|
|
self.updater = [[SUUpdater alloc] initWithHostBundle:self.bundle userDriver:userDriver delegate:nil];
|
|
[self.updater checkForUpdates];
|
|
}
|
|
|
|
@end
|