Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#18 Fixed update run-mode error handling
The update run-mode now uses the --debug option to print out any errors. Created CDUpdate class for handling the Sparkle updates, subclass of CDCommon. Re-organized project files for more logical approach when working on a given area.
- Loading branch information
Mark Whitaker
committed
Nov 1, 2011
1 parent
5985a5c
commit d250170
Showing
39 changed files
with
353 additions
and
370 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// CDUpdate.h | ||
// cocoaDialog | ||
// | ||
// Created by Mark Whitaker on 10/31/11. | ||
// Copyright (c) 2011 Mark Whitaker. All rights reserved. | ||
// | ||
|
||
#import <Sparkle/Sparkle.h> | ||
#import "CDCommon.h" | ||
|
||
@interface CDUpdate : CDCommon | ||
|
||
- (void) update; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// | ||
// CDUpdate.m | ||
// cocoaDialog | ||
// | ||
// Created by Mark Whitaker on 10/31/11. | ||
// Copyright (c) 2011 Mark Whitaker. All rights reserved. | ||
// | ||
|
||
#import "CDUpdate.h" | ||
|
||
@implementation CDUpdate | ||
|
||
- (BOOL) updaterShouldPromptInstall:(SUUpdater *)updater { | ||
return NO; | ||
} | ||
|
||
- (BOOL) updaterShouldRelaunchApplication:(SUUpdater *)updater { | ||
return NO; | ||
} | ||
|
||
- (void) updater:(SUUpdater *)updater didAbortWithError:(NSError *)error { | ||
if ([options hasOpt:@"debug"]) { | ||
NSString *output = @"An unknown error occurred while trying to update."; | ||
if (error != nil) { | ||
output = [error localizedDescription]; | ||
} | ||
[self debug:output]; | ||
} | ||
exit(1); | ||
} | ||
|
||
- (void) updaterDidNotFindUpdate:(SUUpdater *)update { | ||
exit(2); | ||
} | ||
|
||
- (void) update { | ||
SUUpdater * updater = [SUUpdater sharedUpdater]; | ||
[updater setDelegate:self]; | ||
NSURL *appcastURL = [NSURL URLWithString:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"SUFeedURL"]]; | ||
if (appcastURL != nil) { | ||
[updater setFeedURL:appcastURL]; | ||
} | ||
else { | ||
[updater setFeedURL:[NSURL URLWithString:@"https://raw.github.com/mstratman/cocoadialog/master/sparkle-release/appcast.xml"]]; | ||
} | ||
[updater setSendsSystemProfile:YES]; | ||
[updater resetUpdateCycle]; | ||
[updater setAutomaticallyChecksForUpdates:YES]; | ||
if ([options hasOpt:@"quiet"]) { | ||
[updater setAutomaticallyDownloadsUpdates:YES]; | ||
[updater checkForUpdatesInBackground]; | ||
} | ||
else { | ||
[updater setAutomaticallyDownloadsUpdates:NO]; | ||
[updater checkForUpdates:nil]; | ||
} | ||
[NSApp run]; | ||
} | ||
|
||
@end |