forked from sparkle-project/Sparkle
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merged with trunk & updated german localization
- Loading branch information
Showing
42 changed files
with
709 additions
and
241 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// SUDiskImageUnarchiver.h | ||
// Sparkle | ||
// | ||
// Created by Andy Matuschak on 6/16/08. | ||
// Copyright 2008 Andy Matuschak. All rights reserved. | ||
// | ||
|
||
#ifndef SUDISKIMAGEUNARCHIVER_H | ||
#define SUDISKIMAGEUNARCHIVER_H | ||
|
||
#import <Cocoa/Cocoa.h> | ||
#import "SUUnarchiver.h" | ||
|
||
@interface SUDiskImageUnarchiver : 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,79 @@ | ||
// | ||
// SUDiskImageUnarchiver.m | ||
// Sparkle | ||
// | ||
// Created by Andy Matuschak on 6/16/08. | ||
// Copyright 2008 Andy Matuschak. All rights reserved. | ||
// | ||
|
||
#import "SUDiskImageUnarchiver.h" | ||
#import "SUUnarchiver_Private.h" | ||
#import "NTSynchronousTask.h" | ||
|
||
@implementation SUDiskImageUnarchiver | ||
|
||
+ (BOOL)_canUnarchiveURL:(NSURL *)URL | ||
{ | ||
return [URL conformsToType:@"public.disk-image"]; | ||
} | ||
|
||
- (void)start | ||
{ | ||
[NSThread detachNewThreadSelector:@selector(_extractDMG) toTarget:self withObject:nil]; | ||
} | ||
|
||
- (void)_extractDMG | ||
{ | ||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | ||
NSString *archivePath = [archiveURL path]; | ||
BOOL mountedSuccessfully = NO; | ||
|
||
// get a unique mount point path | ||
NSString *mountPrefix = [@"/Volumes" stringByAppendingPathComponent:[[archivePath lastPathComponent] stringByDeletingPathExtension]]; | ||
NSString *mountPoint = [mountPrefix stringByAppendingString:[[NSProcessInfo processInfo] globallyUniqueString]]; | ||
|
||
if ([[NSFileManager defaultManager] fileExistsAtPath:mountPoint]) goto reportError; | ||
|
||
// create mount point folder | ||
[[NSFileManager defaultManager] createDirectoryAtPath:mountPoint attributes:nil]; | ||
if (![[NSFileManager defaultManager] fileExistsAtPath:mountPoint]) goto reportError; | ||
|
||
NSArray* arguments = [NSArray arrayWithObjects:@"attach", archivePath, @"-mountpoint", mountPoint, @"-noverify", @"-nobrowse", @"-noautoopen", nil]; | ||
// set up a pipe and push "yes" (y works too), this will accept any license agreement crap | ||
// not every .dmg needs this, but this will make sure it works with everyone | ||
NSData* yesData = [[[NSData alloc] initWithBytes:"yes\n" length:4] autorelease]; | ||
|
||
NSData *result = [NTSynchronousTask task:@"/usr/bin/hdiutil" directory:@"/" withArgs:arguments input:yesData]; | ||
if (!result) goto reportError; | ||
mountedSuccessfully = YES; | ||
|
||
// Now that we've mounted it, we need to copy out its contents. | ||
NSString *targetPath = [[archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[mountPoint lastPathComponent]]; | ||
if (![[NSFileManager defaultManager] createDirectoryAtPath:targetPath attributes:nil]) goto reportError; | ||
|
||
// We can't just copyPath: from the volume root because that always fails. Seems to be a bug. | ||
id subpathEnumerator = [[[NSFileManager defaultManager] directoryContentsAtPath:mountPoint] objectEnumerator], currentSubpath; | ||
while ((currentSubpath = [subpathEnumerator nextObject])) | ||
{ | ||
if (![[NSFileManager defaultManager] copyPath:[mountPoint stringByAppendingPathComponent:currentSubpath] toPath:[targetPath stringByAppendingPathComponent:currentSubpath] handler:nil]) | ||
goto reportError; | ||
} | ||
|
||
[self performSelectorOnMainThread:@selector(_notifyDelegateOfSuccess) withObject:nil waitUntilDone:NO]; | ||
goto finally; | ||
|
||
reportError: | ||
[self performSelectorOnMainThread:@selector(_notifyDelegateOfFailure) withObject:nil waitUntilDone:NO]; | ||
|
||
finally: | ||
if (mountedSuccessfully) | ||
[NSTask launchedTaskWithLaunchPath:@"/usr/bin/hdiutil" arguments:[NSArray arrayWithObjects:@"detach", mountPoint, @"-force", nil]]; | ||
[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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// SUPipedUnarchiver.h | ||
// Sparkle | ||
// | ||
// Created by Andy Matuschak on 6/16/08. | ||
// Copyright 2008 Andy Matuschak. All rights reserved. | ||
// | ||
|
||
#ifndef SUPIPEDUNARCHIVER_H | ||
#define SUPIPEDUNARCHIVER_H | ||
|
||
#import <Cocoa/Cocoa.h> | ||
#import "SUUnarchiver.h" | ||
|
||
@interface SUPipedUnarchiver : SUUnarchiver { | ||
|
||
} | ||
|
||
@end | ||
|
||
#endif |
Oops, something went wrong.