Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an unarchiver for the delta format so that Sparkle can successful…
…ly install the delta updates.
- Loading branch information
Showing
7 changed files
with
87 additions
and
6 deletions.
There are no files selected for viewing
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,20 @@ | ||
// | ||
// SUBinaryDeltaUnarchiver.h | ||
// Sparkle | ||
// | ||
// Created by Mark Rowe on 2009-06-03. | ||
// Copyright 2009 Mark Rowe. All rights reserved. | ||
// | ||
|
||
#ifndef SUBINARYDELTAUNARCHIVER_H | ||
#define SUBINARYDELTAUNARCHIVER_H | ||
|
||
#import <Cocoa/Cocoa.h> | ||
#import "SUUnarchiver.h" | ||
|
||
@interface SUBinaryDeltaUnarchiver : SUUnarchiver { | ||
} | ||
|
||
@end | ||
|
||
#endif |
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,47 @@ | ||
// | ||
// SUBinaryDeltaUnarchiver.m | ||
// Sparkle | ||
// | ||
// Created by Mark Rowe on 2009-06-03. | ||
// Copyright 2009 Mark Rowe. All rights reserved. | ||
// | ||
|
||
#import "SUBinaryDeltaUnarchiver.h" | ||
#import "SUBinaryDeltaApply.h" | ||
#import "SUUnarchiver_Private.h" | ||
#import "SUHost.h" | ||
#import "NTSynchronousTask.h" | ||
|
||
@implementation SUBinaryDeltaUnarchiver | ||
|
||
+ (BOOL)_canUnarchivePath:(NSString *)path | ||
{ | ||
return [[path pathExtension] isEqualToString:@"delta"]; | ||
} | ||
|
||
- (void)start | ||
{ | ||
[NSThread detachNewThreadSelector:@selector(_applyBinaryDelta) toTarget:self withObject:nil]; | ||
} | ||
|
||
- (void)_applyBinaryDelta | ||
{ | ||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | ||
NSString *sourcePath = [[updateHost bundle] bundlePath]; | ||
NSString *targetPath = [[archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[sourcePath lastPathComponent]]; | ||
|
||
int result = applyBinaryDelta(sourcePath, targetPath, archivePath); | ||
if (!result) | ||
[self performSelectorOnMainThread:@selector(_notifyDelegateOfSuccess) withObject:nil waitUntilDone:NO]; | ||
else | ||
[self performSelectorOnMainThread:@selector(_notifyDelegateOfFailure) withObject:nil waitUntilDone:NO]; | ||
|
||
[pool drain]; | ||
} | ||
|
||
+ (void)load | ||
{ | ||
[self _registerImplementation:self]; | ||
} | ||
|
||
@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
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
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