Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9334fec2b | ||
|
|
8a4e4aea2c | ||
|
|
8fea6670c2 | ||
|
|
19fcca11f0 | ||
|
|
fd082a93d4 | ||
|
|
b9e8830f60 | ||
|
|
8576eb7cad | ||
|
|
cf4c02f1b0 | ||
|
|
8e57ca9284 | ||
|
|
3c2f24c340 | ||
|
|
7a9ff3de48 | ||
|
|
a3d4d9fac4 | ||
|
|
a937fa0a17 | ||
|
|
99be33d83b | ||
|
|
0132377a2a | ||
|
|
7fdedad68e | ||
|
|
aa7c46ba4f | ||
|
|
d263bf4fd0 | ||
|
|
bdb3dd8c36 | ||
|
|
c8ff1c0453 | ||
|
|
bb40663d37 | ||
|
|
b8588543cf | ||
|
|
cc332de4d1 | ||
|
|
d6b1c7de54 | ||
|
|
3a3f46f2c1 | ||
|
|
1ae0999082 | ||
|
|
c265e3f7bf | ||
|
|
2faf8ccdd2 | ||
|
|
2f724659a7 | ||
|
|
445cc55794 | ||
|
|
013e60204d | ||
|
|
b8fecf1f36 | ||
|
|
b319fb50f9 | ||
|
|
698e737b56 | ||
|
|
0be862708f | ||
|
|
d9a3afb869 | ||
|
|
34a78d59fc | ||
|
|
b95008e248 | ||
|
|
27cb8e66fe | ||
|
|
f43c284f14 | ||
|
|
864044e44e | ||
|
|
d0adc0af39 | ||
|
|
64d95bb36f | ||
|
|
a52cbc38a1 | ||
|
|
530a90cb73 | ||
|
|
168c769eb0 | ||
|
|
5b3577c14c | ||
|
|
b9c664687d | ||
|
|
2a3e88bf96 | ||
|
|
004ac3f9ae | ||
|
|
8a04cc726f | ||
|
|
9f2604b888 | ||
|
|
0171ab2d84 | ||
|
|
c3ffd7f739 | ||
|
|
625f229a65 | ||
|
|
674b2238b8 |
No files matched your search
@@ -13,6 +13,8 @@ localizable-strings:
|
||||
release:
|
||||
xcodebuild -scheme Distribution -configuration Release -derivedDataPath "$(BUILDDIR)" build
|
||||
open -R "$(BUILDDIR)/Build/Products/Release/Sparkle-"*.tar.bz2
|
||||
cat Sparkle.podspec
|
||||
@echo "Don't forget to update CocoaPods!"
|
||||
|
||||
build:
|
||||
xcodebuild clean build
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Sparkle [](https://travis-ci.org/sparkle-project/Sparkle) [](https://coveralls.io/github/sparkle-project/Sparkle?branch=master) <a href="https://www.bandwidthhog.com/?utm_source=sparkle-github&utm_medium=badge&utm_campaign=readme"><img src="https://img.shields.io/badge/sponsored%20by-Bandwidth%20Hog-orange.svg" alt="sponsored by: bandwidth hog"></a>
|
||||
# Sparkle [](https://travis-ci.org/sparkle-project/Sparkle) [](https://coveralls.io/github/sparkle-project/Sparkle?branch=master) <a href="https://www.maxcdn.com/?utm_source=sparkle-github&utm_medium=badge&utm_campaign=readme"><img src="https://img.shields.io/badge/sponsored%20by-MaxCDN-orange.svg" alt="sponsored by: MaxCDN"></a>
|
||||
|
||||
An easy-to-use software update framework for Cocoa developers.
|
||||
|
||||
<img src="Resources/Screenshot.png" width="715" alt="Sparkle shows familiar update window with release notes">
|
||||
<img src="Resources/Screenshot.png" width="732" alt="Sparkle shows familiar update window with release notes">
|
||||
|
||||
## Changes since 1.5b
|
||||
|
||||
@@ -50,5 +50,4 @@ Alternatively, build the Distribution scheme in the Xcode UI.
|
||||
|
||||
## Project Sponsor
|
||||
|
||||
[Bandwidth Hog](https://www.bandwidthhog.com/?utm_source=sparkle-github&utm_medium=link&utm_campaign=readme-footer) is a service from MaxCDN
|
||||
that allows you to push software updates to your customers for only 1¢ a gigabyte. Best part is there are no contracts, it is all Pay-as-you-Go.
|
||||
[MaxCDN](https://www.maxcdn.com/?utm_source=sparkle-github&utm_medium=link&utm_campaign=readme-footer)
|
||||
@@ -43,18 +43,21 @@
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "256x256",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon_256x256@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "512x512",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon_512x512.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "512x512",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon_512x512@2x.png",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
|
||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 754 B After Width: | Height: | Size: 827 B |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 130 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 368 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 228 KiB |
|
Before Width: | Height: | Size: 11 KiB |
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "Sparkle"
|
||||
s.version = "1.13.1"
|
||||
s.version = "1.14.0"
|
||||
s.summary = "A software update framework for OS X"
|
||||
s.description = "Sparkle is an easy-to-use software update framework for Cocoa developers."
|
||||
s.homepage = "http://sparkle-project.org"
|
||||
|
||||
@@ -247,16 +247,16 @@ int main(int __unused argc, const char __unused *argv[])
|
||||
|
||||
NSApplication *application = [NSApplication sharedApplication];
|
||||
|
||||
BOOL shouldShowUI = (args.count > 6) ? [args[6] boolValue] : YES;
|
||||
BOOL shouldShowUI = (args.count > 6) ? [[args objectAtIndex:6] boolValue] : YES;
|
||||
if (shouldShowUI) {
|
||||
[application activateIgnoringOtherApps:YES];
|
||||
}
|
||||
|
||||
AppInstaller *appInstaller = [[AppInstaller alloc] initWithHostPath:args[1]
|
||||
relaunchPath:args[2]
|
||||
parentProcessId:[args[3] intValue]
|
||||
updateFolderPath:args[4]
|
||||
shouldRelaunch:(args.count > 5) ? [args[5] boolValue] : YES
|
||||
AppInstaller *appInstaller = [[AppInstaller alloc] initWithHostPath:[args objectAtIndex:1]
|
||||
relaunchPath:[args objectAtIndex:2]
|
||||
parentProcessId:[[args objectAtIndex:3] intValue]
|
||||
updateFolderPath:[args objectAtIndex:4]
|
||||
shouldRelaunch:(args.count > 5) ? [[args objectAtIndex:5] boolValue] : YES
|
||||
shouldShowUI:shouldShowUI];
|
||||
[application setDelegate:appInstaller];
|
||||
[application run];
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import Foundation
|
||||
|
||||
func die(msg: String) {
|
||||
println("ERROR: \(msg)")
|
||||
print("ERROR: \(msg)")
|
||||
exit(1)
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ if enStringsDict == nil {
|
||||
}
|
||||
let enStringsDictKeys = enStringsDict!.allKeys
|
||||
|
||||
let dirPath = sparkleRoot! + "/Sparkle"
|
||||
let dirContents = NSFileManager.defaultManager().contentsOfDirectoryAtPath(dirPath, error: nil) as! [String]
|
||||
let dirPath = NSString(string: sparkleRoot! + "/Sparkle")
|
||||
let dirContents = try! NSFileManager.defaultManager().contentsOfDirectoryAtPath(dirPath as String)
|
||||
let css =
|
||||
"body { font-family: sans-serif; font-size: 10pt; }" +
|
||||
"h1 { font-size: 12pt; }" +
|
||||
@@ -51,14 +51,14 @@ head.addChild(NSXMLElement(name: "style", stringValue: css))
|
||||
|
||||
let locale = NSLocale.currentLocale()
|
||||
for dirEntry in dirContents {
|
||||
if dirEntry.pathExtension != "lproj" || dirEntry == "en.lproj" {
|
||||
if NSString(string: dirEntry).pathExtension != "lproj" || dirEntry == "en.lproj" {
|
||||
continue
|
||||
}
|
||||
|
||||
let lang = locale.displayNameForKey(NSLocaleLanguageCode, value: dirEntry.stringByDeletingPathExtension)
|
||||
let lang = locale.displayNameForKey(NSLocaleLanguageCode, value: NSString(string: dirEntry).stringByDeletingPathExtension)
|
||||
body.addChild(NSXMLElement(name: "h1", stringValue: "\(dirEntry) (\(lang!))"))
|
||||
|
||||
let stringsPath = dirPath.stringByAppendingPathComponent(dirEntry).stringByAppendingPathComponent("Sparkle.strings")
|
||||
let stringsPath = NSString(string: dirPath.stringByAppendingPathComponent(dirEntry)).stringByAppendingPathComponent("Sparkle.strings")
|
||||
let stringsDict = NSDictionary(contentsOfFile: stringsPath)
|
||||
if stringsDict == nil {
|
||||
die("Invalid strings file \(dirEntry)")
|
||||
@@ -90,12 +90,12 @@ for dirEntry in dirContents {
|
||||
let sorter = { (s1: String, s2: String) -> Bool in
|
||||
return s1 < s2
|
||||
}
|
||||
missing.sort(sorter)
|
||||
unlocalized.sort(sorter)
|
||||
unused.sort(sorter)
|
||||
missing.sortInPlace(sorter)
|
||||
unlocalized.sortInPlace(sorter)
|
||||
unused.sortInPlace(sorter)
|
||||
|
||||
let addRow = { (prefix: String, cssClass: String, key: String) -> Void in
|
||||
body.addChild(NSXMLElement(name: "span", attributes: ["class": cssClass], stringValue: " ".join([prefix, key]) + "\n"))
|
||||
body.addChild(NSXMLElement(name: "span", attributes: ["class": cssClass], stringValue: [prefix, key].joinWithSeparator(" ") + "\n"))
|
||||
}
|
||||
|
||||
for key in missing {
|
||||
|
||||
@@ -30,7 +30,10 @@
|
||||
if (!attrName) {
|
||||
continue;
|
||||
}
|
||||
dictionary[attrName] = [attribute stringValue];
|
||||
NSString *attributeStringValue = [attribute stringValue];
|
||||
if (attributeStringValue != nil) {
|
||||
[dictionary setObject:attributeStringValue forKey:attrName];
|
||||
}
|
||||
}
|
||||
return dictionary;
|
||||
}
|
||||
@@ -107,7 +110,7 @@
|
||||
dictionaryWithObject: SULocalizedString(@"An error occurred while parsing the update feed.", nil)
|
||||
forKey: NSLocalizedDescriptionKey];
|
||||
if (error) {
|
||||
userInfo[NSUnderlyingErrorKey] = error;
|
||||
[userInfo setObject:error forKey:NSUnderlyingErrorKey];
|
||||
}
|
||||
[self reportError:[NSError errorWithDomain:SUSparkleErrorDomain
|
||||
code:SUAppcastParseError
|
||||
@@ -149,10 +152,10 @@
|
||||
while (nil != node) {
|
||||
NSString *name = [node name];
|
||||
if (name) {
|
||||
NSMutableArray *nodes = nodesDict[name];
|
||||
NSMutableArray *nodes = [nodesDict objectForKey:name];
|
||||
if (nodes == nil) {
|
||||
nodes = [NSMutableArray array];
|
||||
nodesDict[name] = nodes;
|
||||
[nodesDict setObject:nodes forKey:name];
|
||||
}
|
||||
[nodes addObject:node];
|
||||
}
|
||||
@@ -161,20 +164,19 @@
|
||||
}
|
||||
|
||||
for (NSString *name in nodesDict) {
|
||||
node = [self bestNodeInNodes:nodesDict[name]];
|
||||
node = [self bestNodeInNodes:[nodesDict objectForKey:name]];
|
||||
if ([name isEqualToString:SURSSElementEnclosure]) {
|
||||
// enclosure is flattened as a separate dictionary for some reason
|
||||
NSDictionary *encDict = [(NSXMLElement *)node attributesAsDictionary];
|
||||
dict[name] = encDict;
|
||||
[dict setObject:encDict forKey:name];
|
||||
}
|
||||
else if ([name isEqualToString:SURSSElementPubDate]) {
|
||||
// pubDate is expected to be an NSDate by SUAppcastItem, but the RSS class was returning an NSString
|
||||
NSString *string = node.stringValue;
|
||||
if (string) {
|
||||
NSDate *date = [NSDate dateWithNaturalLanguageString:string];
|
||||
if (date) {
|
||||
dict[name] = date;
|
||||
}
|
||||
// We don't want to parse and create a NSDate instance -
|
||||
// that's a risk we can avoid. We don't use the date anywhere other
|
||||
// than it being accessible from SUAppcastItem
|
||||
NSString *dateString = node.stringValue;
|
||||
if (dateString) {
|
||||
[dict setObject:dateString forKey:name];
|
||||
}
|
||||
}
|
||||
else if ([name isEqualToString:SUAppcastElementDeltas]) {
|
||||
@@ -185,7 +187,7 @@
|
||||
[deltas addObject:[(NSXMLElement *)child attributesAsDictionary]];
|
||||
}
|
||||
}
|
||||
dict[name] = deltas;
|
||||
[dict setObject:deltas forKey:name];
|
||||
}
|
||||
else if ([name isEqualToString:SUAppcastElementTags]) {
|
||||
NSMutableArray *tags = [NSMutableArray array];
|
||||
@@ -196,13 +198,13 @@
|
||||
[tags addObject:childName];
|
||||
}
|
||||
}
|
||||
dict[name] = tags;
|
||||
[dict setObject:tags forKey:name];
|
||||
}
|
||||
else if (name != nil) {
|
||||
// add all other values as strings
|
||||
NSString *theValue = [[node stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
if (theValue != nil) {
|
||||
dict[name] = theValue;
|
||||
[dict setObject:theValue forKey:name];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -220,11 +222,8 @@
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
if ([appcastItems count]) {
|
||||
NSSortDescriptor *sort = [[NSSortDescriptor alloc] initWithKey:@"date" ascending:NO];
|
||||
[appcastItems sortUsingDescriptors:@[sort]];
|
||||
}
|
||||
|
||||
self.items = appcastItems;
|
||||
|
||||
return appcastItems;
|
||||
}
|
||||
@@ -252,9 +251,9 @@
|
||||
NSUnderlyingErrorKey: error,
|
||||
}];
|
||||
|
||||
NSURL *failingUrl = error.userInfo[NSURLErrorFailingURLErrorKey];
|
||||
NSURL *failingUrl = [error.userInfo objectForKey:NSURLErrorFailingURLErrorKey];
|
||||
if (failingUrl) {
|
||||
userInfo[NSURLErrorFailingURLErrorKey] = failingUrl;
|
||||
[userInfo setObject:failingUrl forKey:NSURLErrorFailingURLErrorKey];
|
||||
}
|
||||
|
||||
self.completionBlock([NSError errorWithDomain:SUSparkleErrorDomain code:SUAppcastError userInfo:userInfo]);
|
||||
@@ -265,7 +264,7 @@
|
||||
{
|
||||
// We use this method to pick out the localized version of a node when one's available.
|
||||
if ([nodes count] == 1)
|
||||
return nodes[0];
|
||||
return [nodes objectAtIndex:0];
|
||||
else if ([nodes count] == 0)
|
||||
return nil;
|
||||
|
||||
@@ -276,12 +275,12 @@
|
||||
lang = [[node attributeForName:@"xml:lang"] stringValue];
|
||||
[languages addObject:(lang ? lang : @"")];
|
||||
}
|
||||
lang = [NSBundle preferredLocalizationsFromArray:languages][0];
|
||||
lang = [[NSBundle preferredLocalizationsFromArray:languages] objectAtIndex:0];
|
||||
i = [languages indexOfObject:([languages containsObject:lang] ? lang : @"")];
|
||||
if (i == NSNotFound) {
|
||||
i = 0;
|
||||
}
|
||||
return nodes[i];
|
||||
return [nodes objectAtIndex:i];
|
||||
}
|
||||
|
||||
- (SUAppcast *)copyWithoutDeltaUpdates {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
SU_EXPORT @interface SUAppcastItem : NSObject
|
||||
@property (copy, readonly) NSString *title;
|
||||
@property (copy, readonly) NSDate *date;
|
||||
@property (copy, readonly) NSString *dateString;
|
||||
@property (copy, readonly) NSString *itemDescription;
|
||||
@property (strong, readonly) NSURL *releaseNotesURL;
|
||||
@property (copy, readonly) NSString *DSASignature;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
@interface SUAppcastItem ()
|
||||
@property (copy, readwrite) NSString *title;
|
||||
@property (copy, readwrite) NSDate *date;
|
||||
@property (copy, readwrite) NSString *dateString;
|
||||
@property (copy, readwrite) NSString *itemDescription;
|
||||
@property (strong, readwrite) NSURL *releaseNotesURL;
|
||||
@property (copy, readwrite) NSString *DSASignature;
|
||||
@@ -31,7 +31,7 @@
|
||||
@end
|
||||
|
||||
@implementation SUAppcastItem
|
||||
@synthesize date;
|
||||
@synthesize dateString;
|
||||
@synthesize deltaUpdates;
|
||||
@synthesize displayVersionString;
|
||||
@synthesize DSASignature;
|
||||
@@ -47,12 +47,13 @@
|
||||
|
||||
- (BOOL)isDeltaUpdate
|
||||
{
|
||||
return self.propertiesDictionary[SURSSElementEnclosure][SUAppcastAttributeDeltaFrom] != nil;
|
||||
NSDictionary *rssElementEnclosure = [self.propertiesDictionary objectForKey:SURSSElementEnclosure];
|
||||
return [rssElementEnclosure objectForKey:SUAppcastAttributeDeltaFrom] != nil;
|
||||
}
|
||||
|
||||
- (BOOL)isCriticalUpdate
|
||||
{
|
||||
return [self.propertiesDictionary[SUAppcastElementTags] containsObject:SUAppcastElementCriticalUpdate];
|
||||
return [[self.propertiesDictionary objectForKey:SUAppcastElementTags] containsObject:SUAppcastElementCriticalUpdate];
|
||||
}
|
||||
|
||||
- (BOOL)isInformationOnlyUpdate
|
||||
@@ -69,7 +70,7 @@
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
id enclosure = dict[SURSSElementEnclosure];
|
||||
NSDictionary *enclosure = [dict objectForKey:SURSSElementEnclosure];
|
||||
|
||||
// Try to find a version string.
|
||||
// Finding the new version number from the RSS feed is a little bit hacky. There are two ways:
|
||||
@@ -79,17 +80,17 @@
|
||||
// underscore and the last period as the version number. So name your packages like this: APPNAME_VERSION.extension.
|
||||
// The big caveat with this is that you can't have underscores in your version strings, as that'll confuse Sparkle.
|
||||
// Feel free to change the separator string to a hyphen or something more suited to your needs if you like.
|
||||
NSString *newVersion = enclosure[SUAppcastAttributeVersion];
|
||||
NSString *newVersion = [enclosure objectForKey:SUAppcastAttributeVersion];
|
||||
if (newVersion == nil) {
|
||||
newVersion = dict[SUAppcastAttributeVersion]; // Get version from the item, in case it's a download-less item (i.e. paid upgrade).
|
||||
newVersion = [dict objectForKey:SUAppcastAttributeVersion]; // Get version from the item, in case it's a download-less item (i.e. paid upgrade).
|
||||
}
|
||||
if (newVersion == nil) // no sparkle:version attribute anywhere?
|
||||
{
|
||||
SULog(@"warning: <%@> for URL '%@' is missing %@ attribute. Version comparison may be unreliable. Please always specify %@", SURSSElementEnclosure, enclosure[SURSSAttributeURL], SUAppcastAttributeVersion, SUAppcastAttributeVersion);
|
||||
SULog(@"warning: <%@> for URL '%@' is missing %@ attribute. Version comparison may be unreliable. Please always specify %@", SURSSElementEnclosure, [enclosure objectForKey:SURSSAttributeURL], SUAppcastAttributeVersion, SUAppcastAttributeVersion);
|
||||
|
||||
// Separate the url by underscores and take the last component, as that'll be closest to the end,
|
||||
// then we remove the extension. Hopefully, this will be the version.
|
||||
NSArray *fileComponents = [enclosure[SURSSAttributeURL] componentsSeparatedByString:@"_"];
|
||||
NSArray *fileComponents = [[enclosure objectForKey:SURSSAttributeURL] componentsSeparatedByString:@"_"];
|
||||
if ([fileComponents count] > 1) {
|
||||
newVersion = [[fileComponents lastObject] stringByDeletingPathExtension];
|
||||
}
|
||||
@@ -103,11 +104,11 @@
|
||||
}
|
||||
|
||||
propertiesDictionary = [[NSMutableDictionary alloc] initWithDictionary:dict];
|
||||
self.title = dict[SURSSElementTitle];
|
||||
self.date = dict[SURSSElementPubDate];
|
||||
self.itemDescription = dict[SURSSElementDescription];
|
||||
self.title = [dict objectForKey:SURSSElementTitle];
|
||||
self.dateString = [dict objectForKey:SURSSElementPubDate];
|
||||
self.itemDescription = [dict objectForKey:SURSSElementDescription];
|
||||
|
||||
NSString *theInfoURL = dict[SURSSElementLink];
|
||||
NSString *theInfoURL = [dict objectForKey:SURSSElementLink];
|
||||
if (theInfoURL) {
|
||||
if (![theInfoURL isKindOfClass:[NSString class]]) {
|
||||
SULog(@"%@ -%@ Info URL is not of valid type.", NSStringFromClass([self class]), NSStringFromSelector(_cmd));
|
||||
@@ -125,7 +126,7 @@
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSString *enclosureURLString = enclosure[SURSSAttributeURL];
|
||||
NSString *enclosureURLString = [enclosure objectForKey:SURSSAttributeURL];
|
||||
if (!enclosureURLString && !theInfoURL) {
|
||||
if (error) {
|
||||
*error = @"Feed item's enclosure lacks URL";
|
||||
@@ -139,16 +140,16 @@
|
||||
self.fileURL = [NSURL URLWithString:fileURLString];
|
||||
}
|
||||
if (enclosure) {
|
||||
self.DSASignature = enclosure[SUAppcastAttributeDSASignature];
|
||||
self.DSASignature = [enclosure objectForKey:SUAppcastAttributeDSASignature];
|
||||
}
|
||||
|
||||
self.versionString = newVersion;
|
||||
self.minimumSystemVersion = dict[SUAppcastElementMinimumSystemVersion];
|
||||
self.maximumSystemVersion = dict[SUAppcastElementMaximumSystemVersion];
|
||||
self.minimumSystemVersion = [dict objectForKey:SUAppcastElementMinimumSystemVersion];
|
||||
self.maximumSystemVersion = [dict objectForKey:SUAppcastElementMaximumSystemVersion];
|
||||
|
||||
NSString *shortVersionString = enclosure[SUAppcastAttributeShortVersionString];
|
||||
NSString *shortVersionString = [enclosure objectForKey:SUAppcastAttributeShortVersionString];
|
||||
if (nil == shortVersionString) {
|
||||
shortVersionString = dict[SUAppcastAttributeShortVersionString]; // fall back on the <item>
|
||||
shortVersionString = [dict objectForKey:SUAppcastAttributeShortVersionString]; // fall back on the <item>
|
||||
}
|
||||
|
||||
if (shortVersionString) {
|
||||
@@ -158,7 +159,7 @@
|
||||
}
|
||||
|
||||
// Find the appropriate release notes URL.
|
||||
NSString *releaseNotesString = dict[SUAppcastElementReleaseNotesLink];
|
||||
NSString *releaseNotesString = [dict objectForKey:SUAppcastElementReleaseNotesLink];
|
||||
if (releaseNotesString) {
|
||||
NSURL *url = [NSURL URLWithString:releaseNotesString];
|
||||
if ([url isFileURL]) {
|
||||
@@ -172,19 +173,19 @@
|
||||
self.releaseNotesURL = nil;
|
||||
}
|
||||
|
||||
NSArray *deltaDictionaries = dict[SUAppcastElementDeltas];
|
||||
NSArray *deltaDictionaries = [dict objectForKey:SUAppcastElementDeltas];
|
||||
if (deltaDictionaries) {
|
||||
NSMutableDictionary *deltas = [NSMutableDictionary dictionary];
|
||||
for (NSDictionary *deltaDictionary in deltaDictionaries) {
|
||||
NSString *deltaFrom = deltaDictionary[SUAppcastAttributeDeltaFrom];
|
||||
NSString *deltaFrom = [deltaDictionary objectForKey:SUAppcastAttributeDeltaFrom];
|
||||
if (!deltaFrom) continue;
|
||||
|
||||
NSMutableDictionary *fakeAppCastDict = [dict mutableCopy];
|
||||
[fakeAppCastDict removeObjectForKey:SUAppcastElementDeltas];
|
||||
fakeAppCastDict[SURSSElementEnclosure] = deltaDictionary;
|
||||
[fakeAppCastDict setObject:deltaDictionary forKey:SURSSElementEnclosure];
|
||||
SUAppcastItem *deltaItem = [[SUAppcastItem alloc] initWithDictionary:fakeAppCastDict];
|
||||
|
||||
deltas[deltaFrom] = deltaItem;
|
||||
[deltas setObject:deltaItem forKey:deltaFrom];
|
||||
}
|
||||
self.deltaUpdates = deltas;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
|
||||
@property (assign) BOOL postponingInstallation;
|
||||
@property (assign) BOOL showErrors;
|
||||
@property (assign) BOOL willUpdateOnTermination;
|
||||
@property (assign) BOOL isTerminating;
|
||||
@property (strong) SUAutomaticUpdateAlert *alert;
|
||||
@property (strong) NSTimer *showUpdateAlertTimer;
|
||||
|
||||
@@ -36,6 +37,7 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
|
||||
@synthesize postponingInstallation;
|
||||
@synthesize showErrors;
|
||||
@synthesize willUpdateOnTermination;
|
||||
@synthesize isTerminating;
|
||||
@synthesize alert;
|
||||
@synthesize showUpdateAlertTimer;
|
||||
|
||||
@@ -84,6 +86,21 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
|
||||
|
||||
[updaterDelegate updater:self.updater willInstallUpdateOnQuit:self.updateItem immediateInstallationInvocation:invocation];
|
||||
}
|
||||
//For Swift
|
||||
else if ([updaterDelegate respondsToSelector:@selector(updater: willInstallUpdateOnQuit:immediateInstallationBlock:)])
|
||||
{
|
||||
BOOL relaunch = YES;
|
||||
BOOL showUI = NO;
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[self class] instanceMethodSignatureForSelector:@selector(installWithToolAndRelaunch:displayingUserInterface:)]];
|
||||
[invocation setSelector:@selector(installWithToolAndRelaunch:displayingUserInterface:)];
|
||||
[invocation setArgument:&relaunch atIndex:2];
|
||||
[invocation setArgument:&showUI atIndex:3];
|
||||
[invocation setTarget:self];
|
||||
|
||||
[updaterDelegate updater:self.updater willInstallUpdateOnQuit:self.updateItem immediateInstallationBlock:^{
|
||||
[invocation invoke];
|
||||
}];
|
||||
}
|
||||
|
||||
// If this is marked as a critical update, we'll prompt the user to install it right away.
|
||||
if ([self.updateItem isCriticalUpdate])
|
||||
@@ -131,6 +148,7 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
|
||||
|
||||
- (void)abortUpdate
|
||||
{
|
||||
self.isTerminating = NO;
|
||||
[self stopUpdatingOnTermination];
|
||||
[self invalidateShowUpdateAlertTimer];
|
||||
[super abortUpdate];
|
||||
@@ -153,8 +171,6 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
|
||||
|
||||
case SUInstallLaterChoice:
|
||||
self.postponingInstallation = YES;
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:) name:NSApplicationWillTerminateNotification object:nil];
|
||||
[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(systemWillPowerOff:) name:NSWorkspaceWillPowerOffNotification object:nil];
|
||||
// We're already waiting on quit, just indicate that we're idle.
|
||||
self.interruptible = YES;
|
||||
break;
|
||||
@@ -166,6 +182,7 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void)installWithToolAndRelaunch:(BOOL)relaunch displayingUserInterface:(BOOL)showUI
|
||||
{
|
||||
if (relaunch) {
|
||||
@@ -185,9 +202,22 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
|
||||
|
||||
- (void)applicationWillTerminate:(NSNotification *)__unused note
|
||||
{
|
||||
// We don't want to terminate the app if the user or someone else initiated a termination
|
||||
// Use a property instead of passing an argument to installWithToolAndRelaunch:
|
||||
// because we give the delegate an invocation to our install methods and
|
||||
// this code was added later :|
|
||||
self.isTerminating = YES;
|
||||
|
||||
[self installWithToolAndRelaunch:NO];
|
||||
}
|
||||
|
||||
- (void)terminateApp
|
||||
{
|
||||
if (!self.isTerminating) {
|
||||
[super terminateApp];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)abortUpdateWithError:(NSError *)error
|
||||
{
|
||||
if (self.showErrors) {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
- (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)host;
|
||||
|
||||
- (BOOL)isItemNewer:(SUAppcastItem *)ui;
|
||||
- (BOOL)hostSupportsItem:(SUAppcastItem *)ui;
|
||||
+ (BOOL)hostSupportsItem:(SUAppcastItem *)ui;
|
||||
- (BOOL)itemContainsSkippedVersion:(SUAppcastItem *)ui;
|
||||
- (BOOL)itemContainsValidUpdate:(SUAppcastItem *)ui;
|
||||
- (void)appcastDidFinishLoading:(SUAppcast *)ac;
|
||||
|
||||
@@ -82,12 +82,28 @@
|
||||
return comparator;
|
||||
}
|
||||
|
||||
- (BOOL)isItemNewer:(SUAppcastItem *)ui
|
||||
+ (SUAppcastItem *)bestItemFromAppcastItems:(NSArray *)appcastItems getDeltaItem:(SUAppcastItem * __autoreleasing *)deltaItem withHostVersion:(NSString *)hostVersion comparator:(id<SUVersionComparison>)comparator
|
||||
{
|
||||
return [[self versionComparator] compareVersion:[self.host version] toVersion:[ui versionString]] == NSOrderedAscending;
|
||||
SUAppcastItem *item = nil;
|
||||
for(SUAppcastItem *candidate in appcastItems) {
|
||||
if ([[self class] hostSupportsItem:candidate]) {
|
||||
if (!item || [comparator compareVersion:item.versionString toVersion:candidate.versionString] == NSOrderedAscending) {
|
||||
item = candidate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (item && deltaItem) {
|
||||
SUAppcastItem *deltaUpdateItem = [[item deltaUpdates] objectForKey:hostVersion];
|
||||
if (deltaUpdateItem && [[self class] hostSupportsItem:deltaUpdateItem]) {
|
||||
*deltaItem = deltaUpdateItem;
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
- (BOOL)hostSupportsItem:(SUAppcastItem *)ui
|
||||
+ (BOOL)hostSupportsItem:(SUAppcastItem *)ui
|
||||
{
|
||||
if (([ui minimumSystemVersion] == nil || [[ui minimumSystemVersion] isEqualToString:@""]) &&
|
||||
([ui maximumSystemVersion] == nil || [[ui maximumSystemVersion] isEqualToString:@""])) { return YES; }
|
||||
@@ -106,6 +122,11 @@
|
||||
return minimumVersionOK && maximumVersionOK;
|
||||
}
|
||||
|
||||
- (BOOL)isItemNewer:(SUAppcastItem *)ui
|
||||
{
|
||||
return [[self versionComparator] compareVersion:[self.host version] toVersion:[ui versionString]] == NSOrderedAscending;
|
||||
}
|
||||
|
||||
- (BOOL)itemContainsSkippedVersion:(SUAppcastItem *)ui
|
||||
{
|
||||
NSString *skippedVersion = [self.host objectForUserDefaultsKey:SUSkippedVersionKey];
|
||||
@@ -115,7 +136,7 @@
|
||||
|
||||
- (BOOL)itemContainsValidUpdate:(SUAppcastItem *)ui
|
||||
{
|
||||
return ui && [self hostSupportsItem:ui] && [self isItemNewer:ui] && ![self itemContainsSkippedVersion:ui];
|
||||
return ui && [[self class] hostSupportsItem:ui] && [self isItemNewer:ui] && ![self itemContainsSkippedVersion:ui];
|
||||
}
|
||||
|
||||
- (void)appcastDidFinishLoading:(SUAppcast *)ac
|
||||
@@ -139,20 +160,13 @@
|
||||
}
|
||||
else // If not, we'll take care of it ourselves.
|
||||
{
|
||||
// Find the first update we can actually use.
|
||||
for(SUAppcastItem *i in ac.items) {
|
||||
if ([self hostSupportsItem:i]) {
|
||||
item = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (item) {
|
||||
SUAppcastItem *deltaUpdateItem = [item deltaUpdates][[self.host version]];
|
||||
if (deltaUpdateItem && [self hostSupportsItem:deltaUpdateItem]) {
|
||||
self.nonDeltaUpdateItem = item;
|
||||
item = deltaUpdateItem;
|
||||
}
|
||||
// Find the best supported update
|
||||
SUAppcastItem *deltaUpdateItem = nil;
|
||||
item = [[self class] bestItemFromAppcastItems:ac.items getDeltaItem:&deltaUpdateItem withHostVersion:self.host.version comparator:[self versionComparator]];
|
||||
|
||||
if (item && deltaUpdateItem) {
|
||||
self.nonDeltaUpdateItem = item;
|
||||
item = deltaUpdateItem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,8 +208,36 @@
|
||||
}]];
|
||||
}
|
||||
|
||||
- (NSString *)appCachePath
|
||||
{
|
||||
NSArray *cachePaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
|
||||
NSString *cachePath = nil;
|
||||
if ([cachePaths count]) {
|
||||
cachePath = [cachePaths objectAtIndex:0];
|
||||
}
|
||||
if (!cachePath) {
|
||||
SULog(@"Failed to find user's cache directory! Using system default");
|
||||
cachePath = NSTemporaryDirectory();
|
||||
}
|
||||
|
||||
NSString *name = [self.host.bundle bundleIdentifier];
|
||||
if (!name) {
|
||||
name = [self.host name];
|
||||
}
|
||||
|
||||
cachePath = [cachePath stringByAppendingPathComponent:name];
|
||||
cachePath = [cachePath stringByAppendingPathComponent:@SPARKLE_BUNDLE_IDENTIFIER];
|
||||
return cachePath;
|
||||
}
|
||||
|
||||
- (void)downloadUpdate
|
||||
{
|
||||
// Clear cache directory so that downloads can't possibly accumulate inside
|
||||
NSString *appCachePath = [self appCachePath];
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:appCachePath]) {
|
||||
[[NSFileManager defaultManager] removeItemAtPath:appCachePath error:NULL];
|
||||
}
|
||||
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[self.updateItem fileURL]];
|
||||
[request setValue:[self.updater userAgentString] forHTTPHeaderField:@"User-Agent"];
|
||||
if ([[self.updater delegate] respondsToSelector:@selector(updater:willDownloadUpdate:withRequest:)]) {
|
||||
@@ -209,13 +251,14 @@
|
||||
- (void)download:(NSURLDownload *)__unused d decideDestinationWithSuggestedFilename:(NSString *)name
|
||||
{
|
||||
NSString *downloadFileName = [NSString stringWithFormat:@"%@ %@", [self.host name], [self.updateItem versionString]];
|
||||
|
||||
|
||||
self.tempDir = [self.host.appCachePath stringByAppendingPathComponent:downloadFileName];
|
||||
|
||||
NSString *appCachePath = [self appCachePath];
|
||||
|
||||
self.tempDir = [appCachePath stringByAppendingPathComponent:downloadFileName];
|
||||
int cnt = 1;
|
||||
while ([[NSFileManager defaultManager] fileExistsAtPath:self.tempDir] && cnt <= 999)
|
||||
{
|
||||
self.tempDir = [self.host.appCachePath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@ %d", downloadFileName, cnt++]];
|
||||
self.tempDir = [appCachePath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@ %d", downloadFileName, cnt++]];
|
||||
}
|
||||
|
||||
// Create the temporary directory if necessary.
|
||||
@@ -321,7 +364,7 @@
|
||||
|
||||
- (void)download:(NSURLDownload *)__unused download didFailWithError:(NSError *)error
|
||||
{
|
||||
NSURL *failingUrl = error.userInfo[NSURLErrorFailingURLErrorKey];
|
||||
NSURL *failingUrl = [error.userInfo objectForKey:NSURLErrorFailingURLErrorKey];
|
||||
if (!failingUrl) {
|
||||
failingUrl = [self.updateItem fileURL];
|
||||
}
|
||||
@@ -337,10 +380,10 @@
|
||||
NSUnderlyingErrorKey: error,
|
||||
}];
|
||||
if (failingUrl) {
|
||||
userInfo[NSURLErrorFailingURLErrorKey] = failingUrl;
|
||||
[userInfo setObject:failingUrl forKey:NSURLErrorFailingURLErrorKey];
|
||||
}
|
||||
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:userInfo]];
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUDownloadError userInfo:userInfo]];
|
||||
}
|
||||
|
||||
- (BOOL)download:(NSURLDownload *)__unused download shouldDecodeSourceDataOfMIMEType:(NSString *)encodingType
|
||||
@@ -466,7 +509,7 @@
|
||||
NSString *const relaunchToolName = @"" SPARKLE_RELAUNCH_TOOL_NAME;
|
||||
NSString *const relaunchPathToCopy = [sparkleBundle pathForResource:relaunchToolName ofType:@"app"];
|
||||
if (relaunchPathToCopy != nil) {
|
||||
NSString *targetPath = [self.host.appCachePath stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]];
|
||||
NSString *targetPath = [[self appCachePath] stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]];
|
||||
|
||||
SUFileManager *fileManager = [SUFileManager fileManagerAllowingAuthorization:NO];
|
||||
NSError *error = nil;
|
||||
@@ -511,6 +554,7 @@
|
||||
if ([updaterDelegate respondsToSelector:@selector(pathToRelaunchForUpdater:)]) {
|
||||
pathToRelaunch = [updaterDelegate pathToRelaunchForUpdater:self.updater];
|
||||
}
|
||||
|
||||
[NSTask launchedTaskWithLaunchPath:relaunchToolPath arguments:@[[self.host bundlePath],
|
||||
pathToRelaunch,
|
||||
[NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]],
|
||||
@@ -520,6 +564,7 @@
|
||||
[self terminateApp];
|
||||
}
|
||||
|
||||
// Note: this is overridden by the automatic update driver to not terminate in some cases
|
||||
- (void)terminateApp
|
||||
{
|
||||
[NSApp terminate:self];
|
||||
@@ -565,8 +610,8 @@
|
||||
NSError *errorToDisplay = error;
|
||||
int finiteRecursion=5;
|
||||
do {
|
||||
SULog(@"Error: %@ %@ (URL %@)", errorToDisplay.localizedDescription, errorToDisplay.localizedFailureReason, errorToDisplay.userInfo[NSURLErrorFailingURLErrorKey]);
|
||||
errorToDisplay = errorToDisplay.userInfo[NSUnderlyingErrorKey];
|
||||
SULog(@"Error: %@ %@ (URL %@)", errorToDisplay.localizedDescription, errorToDisplay.localizedFailureReason, [errorToDisplay.userInfo objectForKey:NSURLErrorFailingURLErrorKey]);
|
||||
errorToDisplay = [errorToDisplay.userInfo objectForKey:NSUnderlyingErrorKey];
|
||||
} while(--finiteRecursion && errorToDisplay);
|
||||
}
|
||||
if (self.download) {
|
||||
|
||||
@@ -141,11 +141,11 @@ static id valueOrNSNull(id value) {
|
||||
NSDictionary *signingDict = CFBridgingRelease(signingInfo);
|
||||
NSMutableDictionary *relevantInfo = [NSMutableDictionary dictionary];
|
||||
for (NSString *key in @[@"format", @"identifier", @"requirements", @"teamid", @"signing-time"]) {
|
||||
relevantInfo[key] = valueOrNSNull(signingDict[key]);
|
||||
[relevantInfo setObject:valueOrNSNull([signingDict objectForKey:key]) forKey:key];
|
||||
}
|
||||
NSDictionary *infoPlist = signingDict[@"info-plist"];
|
||||
relevantInfo[@"version"] = valueOrNSNull(infoPlist[@"CFBundleShortVersionString"]);
|
||||
relevantInfo[@"build"] = valueOrNSNull(infoPlist[(__bridge NSString *)kCFBundleVersionKey]);
|
||||
NSDictionary *infoPlist = [signingDict objectForKey:@"info-plist"];
|
||||
[relevantInfo setObject:valueOrNSNull([infoPlist objectForKey:@"CFBundleShortVersionString"]) forKey:@"version"];
|
||||
[relevantInfo setObject:valueOrNSNull([infoPlist objectForKey:(__bridge NSString *)kCFBundleVersionKey]) forKey:@"build"];
|
||||
SULog(@"%@: %@", label, relevantInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ extern NSString *const SUPublicDSAKeyFileKey;
|
||||
extern NSString *const SUAutomaticallyUpdateKey;
|
||||
extern NSString *const SUAllowsAutomaticUpdatesKey;
|
||||
extern NSString *const SUEnableAutomaticChecksKey;
|
||||
extern NSString *const SUEnableAutomaticChecksKeyOld;
|
||||
extern NSString *const SUEnableSystemProfilingKey;
|
||||
extern NSString *const SUSendProfileInfoKey;
|
||||
extern NSString *const SULastProfileSubmitDateKey;
|
||||
|
||||
@@ -38,7 +38,6 @@ NSString *const SUAutomaticallyUpdateKey = @"SUAutomaticallyUpdate";
|
||||
NSString *const SUAllowsAutomaticUpdatesKey = @"SUAllowsAutomaticUpdates";
|
||||
NSString *const SUEnableSystemProfilingKey = @"SUEnableSystemProfiling";
|
||||
NSString *const SUEnableAutomaticChecksKey = @"SUEnableAutomaticChecks";
|
||||
NSString *const SUEnableAutomaticChecksKeyOld = @"SUCheckAtStartup";
|
||||
NSString *const SUSendProfileInfoKey = @"SUSendProfileInfo";
|
||||
NSString *const SULastProfileSubmitDateKey = @"SULastProfileSubmissionDate";
|
||||
NSString *const SUPromptUserOnFirstLaunchKey = @"SUPromptUserOnFirstLaunch";
|
||||
|
||||
@@ -23,10 +23,11 @@ typedef NS_ENUM(OSStatus, SUError) {
|
||||
SUNoUpdateError = 1001,
|
||||
SUAppcastError = 1002,
|
||||
SURunningFromDiskImageError = 1003,
|
||||
|
||||
// Downlaod phase errors.
|
||||
|
||||
// Download phase errors.
|
||||
SUTemporaryDirectoryError = 2000,
|
||||
|
||||
SUDownloadError = 2001,
|
||||
|
||||
// Extraction phase errors.
|
||||
SUUnarchivingError = 3000,
|
||||
SUSignatureError = 3001,
|
||||
|
||||
@@ -25,6 +25,15 @@
|
||||
*/
|
||||
+ (instancetype)fileManagerAllowingAuthorization:(BOOL)allowsAuthorization;
|
||||
|
||||
/**
|
||||
* Returns a file manager that allows or disallows authorizing for file operations based on the current file manager
|
||||
* @return A file manager instance that can perform authorized operations if the current file manager has already performed them.
|
||||
* If the current file manager instance hasn't yet performed authorized operations, then neither can the instance returned by this method
|
||||
*
|
||||
* This may return a newly created file manager or re-use the existing file manager depending on the current authorization rights.
|
||||
*/
|
||||
- (instancetype)fileManagerByPreservingAuthorizationRights;
|
||||
|
||||
/**
|
||||
* Creates a temporary directory on the same volume as a provided URL
|
||||
* @param preferredName A name that may be used when creating the temporary directory. Note that in the uncommon case this name is used, the temporary directory will be created inside the directory pointed by appropriateURL
|
||||
|
||||
@@ -88,12 +88,18 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
+ (instancetype)fileManagerAllowingAuthorization:(BOOL)allowsAuthorization
|
||||
{
|
||||
return [[self alloc] initAllowingAuthorization:allowsAuthorization];
|
||||
}
|
||||
|
||||
- (instancetype)fileManagerByPreservingAuthorizationRights
|
||||
{
|
||||
// Check if we don't allow authorization, or that we haven't needed to authorize yet, to create or re-use a
|
||||
// file manager instance with these restrictions
|
||||
return (_allowsAuthorization && _auth != NULL) ? self : [SUFileManager fileManagerAllowingAuthorization:NO];
|
||||
}
|
||||
|
||||
// Acquires an authorization reference which is intended to be used for future authorized file operations
|
||||
- (BOOL)_acquireAuthorizationWithError:(NSError *__autoreleasing *)error
|
||||
{
|
||||
@@ -542,7 +548,19 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (chown(path, ownerID.unsignedIntValue, groupID.unsignedIntValue) != 0) {
|
||||
int fileDescriptor = open(path, O_RDONLY | O_SYMLINK);
|
||||
if (fileDescriptor == -1) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to open file descriptor to %@", targetURL.path.lastPathComponent] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
// We use fchown instead of chown because the latter can follow symbolic links
|
||||
BOOL success = fchown(fileDescriptor, ownerID.unsignedIntValue, groupID.unsignedIntValue) == 0;
|
||||
close(fileDescriptor);
|
||||
|
||||
if (!success) {
|
||||
if (errno == EPERM) {
|
||||
if (needsAuth != NULL) {
|
||||
*needsAuth = YES;
|
||||
@@ -695,7 +713,20 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (utimes(path, NULL) == 0) {
|
||||
int fileDescriptor = open(path, O_RDONLY | O_SYMLINK);
|
||||
if (fileDescriptor == -1) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to open file descriptor to %@", targetURL.path.lastPathComponent] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
// Using futimes() because utimes() follows symbolic links
|
||||
BOOL updatedTime = (futimes(fileDescriptor, NULL) == 0);
|
||||
|
||||
close(fileDescriptor);
|
||||
|
||||
if (updatedTime) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -710,7 +741,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL success = AuthorizationExecuteWithPrivilegesAndWait(_auth, "/usr/bin/touch", kAuthorizationFlagDefaults, (char *[]){ "--", path, NULL });
|
||||
BOOL success = AuthorizationExecuteWithPrivilegesAndWait(_auth, "/usr/bin/touch", kAuthorizationFlagDefaults, (char *[]){ "-h", "--", path, NULL });
|
||||
if (!success && error != NULL) {
|
||||
NSString *errorMessage = [NSString stringWithFormat:@"Failed to update modification & access time on %@ with authentication.", targetURL.path.lastPathComponent];
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey: errorMessage }];
|
||||
@@ -903,7 +934,10 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
|
||||
|
||||
if (canUseNewTrashAPI) {
|
||||
NSError *trashError = nil;
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wpartial-availability"
|
||||
success = [_fileManager trashItemAtURL:tempItemURL resultingItemURL:NULL error:&trashError];
|
||||
#pragma clang diagnostic pop
|
||||
if (!success && error != NULL) {
|
||||
*error = trashError;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ typedef struct {
|
||||
- (instancetype)initWithBundle:(NSBundle *)aBundle;
|
||||
@property (readonly, copy) NSString *bundlePath;
|
||||
@property (readonly) BOOL allowsAutomaticUpdates;
|
||||
@property (readonly, copy) NSString *appCachePath;
|
||||
@property (readonly, copy) NSString *installationPath;
|
||||
@property (readonly, copy) NSString *name;
|
||||
@property (readonly, copy) NSString *version;
|
||||
|
||||
@@ -71,29 +71,10 @@
|
||||
}
|
||||
|
||||
// Can we automatically update in the background without bugging the user (e.g, with a administrator password prompt)?
|
||||
return [[NSFileManager defaultManager] isWritableFileAtPath:self.bundlePath];
|
||||
}
|
||||
|
||||
- (NSString *)appCachePath
|
||||
{
|
||||
NSArray *cachePaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
|
||||
NSString *cachePath = nil;
|
||||
if ([cachePaths count]) {
|
||||
cachePath = cachePaths[0];
|
||||
}
|
||||
if (!cachePath) {
|
||||
SULog(@"Failed to find user's cache directory! Using system default");
|
||||
cachePath = NSTemporaryDirectory();
|
||||
}
|
||||
|
||||
NSString *name = [self.bundle bundleIdentifier];
|
||||
if (!name) {
|
||||
name = [self name];
|
||||
}
|
||||
|
||||
cachePath = [cachePath stringByAppendingPathComponent:name];
|
||||
cachePath = [cachePath stringByAppendingPathComponent:@"Sparkle"];
|
||||
return cachePath;
|
||||
// Note it's very well possible to have the bundle be writable but not be able to write into the parent directory
|
||||
// And if the bundle isn't writable, but we can write into the parent directory, we will still need to authorize to replace it
|
||||
NSString *bundlePath = [self bundlePath];
|
||||
return [[NSFileManager defaultManager] isWritableFileAtPath:bundlePath.stringByDeletingLastPathComponent] && [[NSFileManager defaultManager] isWritableFileAtPath:bundlePath];
|
||||
}
|
||||
|
||||
- (NSString *)installationPath
|
||||
|
||||
@@ -28,7 +28,11 @@
|
||||
return version;
|
||||
}
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wpartial-availability"
|
||||
return [[NSProcessInfo processInfo] operatingSystemVersion];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
+ (BOOL)isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion)version
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
NSString *lastPathComponent = [path lastPathComponent];
|
||||
for (NSString *currentType in typeSelectorDictionary)
|
||||
{
|
||||
NSString *value = typeSelectorDictionary[currentType];
|
||||
NSString *value = [typeSelectorDictionary objectForKey:currentType];
|
||||
assert(value);
|
||||
|
||||
if ([currentType length] > [lastPathComponent length]) continue;
|
||||
|
||||
@@ -139,15 +139,18 @@
|
||||
return NO;
|
||||
}
|
||||
|
||||
// From here on out, we don't really need to bring up authorization if we haven't done so prior
|
||||
SUFileManager *constrainedFileManager = [fileManager fileManagerByPreservingAuthorizationRights];
|
||||
|
||||
// Cleanup: move the old app to the trash
|
||||
NSError *trashError = nil;
|
||||
if (![fileManager moveItemAtURLToTrash:oldTempURL error:&trashError]) {
|
||||
if (![constrainedFileManager moveItemAtURLToTrash:oldTempURL error:&trashError]) {
|
||||
SULog(@"Failed to move %@ to trash with error %@", oldTempURL, trashError);
|
||||
}
|
||||
|
||||
[fileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
|
||||
[constrainedFileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
|
||||
|
||||
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
|
||||
[constrainedFileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -91,8 +91,8 @@ typedef NS_ENUM(NSInteger, SUCharacterType) {
|
||||
|
||||
n = MIN([partsA count], [partsB count]);
|
||||
for (i = 0; i < n; ++i) {
|
||||
partA = partsA[i];
|
||||
partB = partsB[i];
|
||||
partA = [partsA objectAtIndex:i];
|
||||
partB = [partsB objectAtIndex:i];
|
||||
|
||||
typeA = [self typeOfCharacter:partA];
|
||||
typeB = [self typeOfCharacter:partB];
|
||||
@@ -142,11 +142,11 @@ typedef NS_ENUM(NSInteger, SUCharacterType) {
|
||||
NSComparisonResult shorterResult, largerResult;
|
||||
|
||||
if ([partsA count] > [partsB count]) {
|
||||
missingPart = partsA[n];
|
||||
missingPart = [partsA objectAtIndex:n];
|
||||
shorterResult = NSOrderedAscending;
|
||||
largerResult = NSOrderedDescending;
|
||||
} else {
|
||||
missingPart = partsB[n];
|
||||
missingPart = [partsB objectAtIndex:n];
|
||||
shorterResult = NSOrderedDescending;
|
||||
largerResult = NSOrderedAscending;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ static NSString *const SUSystemProfilerPreferredLanguageKey = @"lang";
|
||||
error = sysctlbyname("hw.model", cpuModel, &length, NULL, 0);
|
||||
if (error == 0) {
|
||||
NSString *rawModelName = @(cpuModel);
|
||||
NSString *visibleModelName = modelTranslation[rawModelName];
|
||||
NSString *visibleModelName = [modelTranslation objectForKey:rawModelName];
|
||||
if (visibleModelName == nil) {
|
||||
visibleModelName = rawModelName;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ static NSString *const SUSystemProfilerPreferredLanguageKey = @"lang";
|
||||
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||
NSArray *languages = [defs objectForKey:@"AppleLanguages"];
|
||||
if ([languages count] > 0) {
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:@[SUSystemProfilerPreferredLanguageKey, @"Preferred Language", languages[0], languages[0]] forKeys:profileDictKeys]];
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:@[SUSystemProfilerPreferredLanguageKey, @"Preferred Language", [languages objectAtIndex:0], [languages objectAtIndex:0]] forKeys:profileDictKeys]];
|
||||
}
|
||||
|
||||
// Application sending the request
|
||||
|
||||
@@ -164,8 +164,11 @@
|
||||
SULocalizedString(@"GB", @"the unit for gigabytes")];
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wpartial-availability"
|
||||
return [NSByteCountFormatter stringFromByteCount:value
|
||||
countStyle:NSByteCountFormatterCountStyleFile];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
- (void)download:(NSURLDownload *)__unused download didReceiveDataOfLength:(NSUInteger)length
|
||||
|
||||
@@ -345,6 +345,15 @@ SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey;
|
||||
*/
|
||||
- (void)updater:(SUUpdater *)updater willInstallUpdateOnQuit:(SUAppcastItem *)item immediateInstallationInvocation:(NSInvocation *)invocation;
|
||||
|
||||
/*!
|
||||
Called when an update is scheduled to be silentyl installed on quit. Swift compatible.
|
||||
|
||||
\param updater the SUUpdater instance.
|
||||
\param item The appcast item corresponding to the udpate that is proposed to be installed.
|
||||
\param restartBlock Can be used to trigger an immediate silent install and relaunch.
|
||||
*/
|
||||
- (void)updater:(SUUpdater *)updater willInstallUpdateOnQuit:(SUAppcastItem *)item immediateInstallationBlock:(void (^)()) restartBlock;
|
||||
|
||||
/*!
|
||||
Calls after an update that was scheduled to be silently installed on quit has been canceled.
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
+ (SUUpdater *)updaterForBundle:(NSBundle *)bundle
|
||||
{
|
||||
if (bundle == nil) bundle = [NSBundle mainBundle];
|
||||
id updater = sharedUpdaters[[NSValue valueWithNonretainedObject:bundle]];
|
||||
id updater = [sharedUpdaters objectForKey:[NSValue valueWithNonretainedObject:bundle]];
|
||||
if (updater == nil) {
|
||||
updater = [[[self class] alloc] initForBundle:bundle];
|
||||
}
|
||||
@@ -93,7 +93,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
[self registerAsObserver];
|
||||
}
|
||||
|
||||
id updater = sharedUpdaters[[NSValue valueWithNonretainedObject:bundle]];
|
||||
id updater = [sharedUpdaters objectForKey:[NSValue valueWithNonretainedObject:bundle]];
|
||||
if (updater)
|
||||
{
|
||||
self = updater;
|
||||
@@ -103,7 +103,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
if (sharedUpdaters == nil) {
|
||||
sharedUpdaters = [[NSMutableDictionary alloc] init];
|
||||
}
|
||||
sharedUpdaters[[NSValue valueWithNonretainedObject:bundle]] = self;
|
||||
[sharedUpdaters setObject:self forKey:[NSValue valueWithNonretainedObject:bundle]];
|
||||
host = [[SUHost alloc] initWithBundle:bundle];
|
||||
|
||||
// This runs the permission prompt if needed, but never before the app has finished launching because the runloop won't run before that
|
||||
@@ -132,7 +132,8 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
[self showAlertText:@"Insecure update error!"
|
||||
informativeText:@"For security reasons, you need to code sign your application or sign your updates with a DSA key. See Sparkle's documentation for more information."];
|
||||
} else if (isMainBundle && !hasPublicDSAKey && !servingOverHttps) {
|
||||
SULog(@"WARNING: Serving updates over HTTP without signing them with a DSA key is deprecated and may not be possible in a future release. Please serve your updates over https, or sign them with a DSA key, or do both. See Sparkle's documentation for more information.");
|
||||
[self showAlertText:@"Insecure update error!"
|
||||
informativeText:@"For security reasons, you need to serve your updates over https and/or sign your updates with a DSA key. See Sparkle's documentation for more information."];
|
||||
}
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101100
|
||||
@@ -206,6 +207,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
if ([note object] == self.driver && [self.driver finished])
|
||||
{
|
||||
self.driver = nil;
|
||||
[self updateLastUpdateCheckDate];
|
||||
[self scheduleNextUpdateCheck];
|
||||
}
|
||||
}
|
||||
@@ -215,6 +217,13 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
return [self.host objectForUserDefaultsKey:SULastCheckTimeKey];
|
||||
}
|
||||
|
||||
- (void)updateLastUpdateCheckDate
|
||||
{
|
||||
[self willChangeValueForKey:@"lastUpdateCheckDate"];
|
||||
[self.host setObject:[NSDate date] forUserDefaultsKey:SULastCheckTimeKey];
|
||||
[self didChangeValueForKey:@"lastUpdateCheckDate"];
|
||||
}
|
||||
|
||||
- (void)scheduleNextUpdateCheck
|
||||
{
|
||||
if (self.checkTimer)
|
||||
@@ -243,7 +252,10 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
|
||||
- (void)putFeedURLIntoDictionary:(NSMutableDictionary *)theDict // You release this.
|
||||
{
|
||||
theDict[@"feedURL"] = [self feedURL];
|
||||
NSURL *feedURL = [self feedURL];
|
||||
if (feedURL != nil) {
|
||||
[theDict setObject:feedURL forKey:@"feedURL"];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesInBgReachabilityCheckWithDriver:(SUUpdateDriver *)inDriver /* RUNS ON ITS OWN THREAD */
|
||||
@@ -265,7 +277,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
[self putFeedURLIntoDictionary:theDict]; // Get feed URL on main thread, it's not safe to call elsewhere.
|
||||
});
|
||||
|
||||
const char *hostname = [[(NSURL *)theDict[@"feedURL"] host] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
const char *hostname = [[(NSURL *)[theDict objectForKey:@"feedURL"] host] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, hostname);
|
||||
Boolean reachabilityResult = NO;
|
||||
// If the feed's using a file:// URL, we won't be able to use reachability.
|
||||
@@ -345,9 +357,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
if ([self updateInProgress]) { return; }
|
||||
if (self.checkTimer) { [self.checkTimer invalidate]; self.checkTimer = nil; } // Timer is non-repeating, may have invalidated itself, so we had to retain it.
|
||||
|
||||
[self willChangeValueForKey:@"lastUpdateCheckDate"];
|
||||
[self.host setObject:[NSDate date] forUserDefaultsKey:SULastCheckTimeKey];
|
||||
[self didChangeValueForKey:@"lastUpdateCheckDate"];
|
||||
[self updateLastUpdateCheckDate];
|
||||
|
||||
if( [self.delegate respondsToSelector: @selector(updaterMayCheckForUpdates:)] && ![self.delegate updaterMayCheckForUpdates: self] )
|
||||
{
|
||||
@@ -531,7 +541,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
// Build up the parameterized URL.
|
||||
NSMutableArray *parameterStrings = [NSMutableArray array];
|
||||
for (NSDictionary *currentProfileInfo in parameters) {
|
||||
[parameterStrings addObject:[NSString stringWithFormat:@"%@=%@", [[currentProfileInfo[@"key"] description] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], [[currentProfileInfo[@"value"] description] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
|
||||
[parameterStrings addObject:[NSString stringWithFormat:@"%@=%@", [[[currentProfileInfo objectForKey:@"key"] description] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], [[[currentProfileInfo objectForKey:@"value"] description] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
|
||||
}
|
||||
|
||||
NSString *separatorCharacter = @"?";
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
- (BOOL)itemContainsValidUpdate:(SUAppcastItem *)ui
|
||||
{
|
||||
// We don't check to see if this update's been skipped, because the user explicitly *asked* if he had the latest version.
|
||||
return [self hostSupportsItem:ui] && [self isItemNewer:ui];
|
||||
return [[self class] hostSupportsItem:ui] && [self isItemNewer:ui];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<constraint firstAttribute="width" priority="800" constant="64" id="QhW-E9-8Br"/>
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9046" systemVersion="15C27e" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9046"/>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9532"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="SUAutomaticUpdateAlert">
|
||||
@@ -14,26 +15,24 @@
|
||||
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="SUAutomaticUpdateAlert" animationBehavior="default" id="5" userLabel="Window">
|
||||
<windowStyleMask key="styleMask" titled="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="114" y="521" width="616" height="152"/>
|
||||
<rect key="contentRect" x="114" y="521" width="691" height="152"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1178"/>
|
||||
<value key="minSize" type="size" width="511" height="152"/>
|
||||
<view key="contentView" id="6">
|
||||
<rect key="frame" x="0.0" y="0.0" width="616" height="152"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="691" height="152"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<imageView id="7">
|
||||
<rect key="frame" x="23" y="73" width="64" height="64"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="38"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="10"/>
|
||||
</connections>
|
||||
</imageView>
|
||||
<textField verticalHuggingPriority="750" id="8">
|
||||
<rect key="frame" x="105" y="120" width="497" height="17"/>
|
||||
<rect key="frame" x="105" y="120" width="570" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" sendsActionOnEndEditing="YES" id="39">
|
||||
<font key="font" metaFont="systemBold"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -44,9 +43,8 @@
|
||||
</connections>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" id="9">
|
||||
<rect key="frame" x="105" y="81" width="497" height="31"/>
|
||||
<rect key="frame" x="105" y="81" width="570" height="31"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" sendsActionOnEndEditing="YES" id="40">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -57,9 +55,8 @@
|
||||
</connections>
|
||||
</textField>
|
||||
<button verticalHuggingPriority="750" id="15">
|
||||
<rect key="frame" x="435" y="12" width="167" height="32"/>
|
||||
<rect key="frame" x="462" y="12" width="215" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="push" title="Installieren und erneut starten" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="41">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
@@ -71,25 +68,9 @@ DQ
|
||||
<action selector="installNow:" target="-2" id="33"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" id="16">
|
||||
<rect key="frame" x="306" y="12" width="129" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="push" title="Beim Beenden installieren" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="42">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<string key="keyEquivalent" base64-UTF8="YES">
|
||||
Gw
|
||||
</string>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="installLater:" target="-2" id="34"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" id="30">
|
||||
<rect key="frame" x="102" y="12" width="116" height="32"/>
|
||||
<rect key="frame" x="102" y="12" width="132" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="push" title="Nicht installieren" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="44">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
@@ -101,7 +82,6 @@ Gw
|
||||
<button id="17">
|
||||
<rect key="frame" x="105" y="58" width="619" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="check" title="Aktualisierungen in Zukunft automatisch herunterladen und installieren" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="43">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
@@ -110,9 +90,23 @@ Gw
|
||||
<binding destination="18" name="value" keyPath="values.SUAutomaticallyUpdate" id="19"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" id="16">
|
||||
<rect key="frame" x="265" y="12" width="197" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
|
||||
<buttonCell key="cell" type="push" title="Beim Beenden installieren" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="42">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<string key="keyEquivalent" base64-UTF8="YES">
|
||||
Gw
|
||||
</string>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="installLater:" target="-2" id="34"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<animations/>
|
||||
</view>
|
||||
<point key="canvasLocation" x="447.5" y="312"/>
|
||||
</window>
|
||||
<userDefaultsController representsSharedInstance="YES" id="18" userLabel="Shared Defaults"/>
|
||||
</objects>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"%1$@ %2$@ has been downloaded and is ready to use! This is an important update; would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ wurde heruntergeladen und steht zur Verwendung bereit! Dies ist eine wichtige Aktualisierung. Möchten Sie %1$@ jetzt durch die neue Version ersetzen und neu starten?";
|
||||
|
||||
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ wurde heruntergeladen und steht zur Verwendung bereit! Möchten Sie %1$@ jetzt durch die neue Version ersetzen und neu starten?";
|
||||
|
||||
"%1$@ can't be updated when it's running from a read-only volume like a disk image or an optical drive. Move %1$@ to your Applications folder, relaunch it from there, and try again." = "%1$@ kann nicht aktualisiert werden, wenn es von einem Volumen ohne Schreibzugriff (z.B. Disk Image oder CD/DVD) gestartet wurde. Kopieren Sie %1$@ in den Programme Ordner, aktualisieren Sie es von dort.";
|
||||
@@ -8,7 +10,7 @@
|
||||
"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ ist verfügbar (Sie verwenden Version %3$@). Möchten Sie die neue Version jetzt herunterladen?";
|
||||
|
||||
/* Description text for SUUpdateAlert when the update informational with no download. */
|
||||
"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ is now available--you have %3$@. Would you like to learn more about this update on the web?";
|
||||
"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ ist verfügbar (Sie verwenden Version %3$@). Möchten Sie mehr über diese Aktualisierung erfahren?";
|
||||
|
||||
"%@ downloaded" = "%@ heruntergeladen";
|
||||
|
||||
@@ -30,6 +32,8 @@
|
||||
|
||||
"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@." = "Beim erneuten Starten von %1$@ ist ein Fehler aufgetreten. Die neue Version von %1$@ steht beim nächsten Programmstart zur Verfügung.";
|
||||
|
||||
"An important update to %@ is ready to install" = "Eine wichtige Aktualisierung von %@ steht zur Installation bereit";
|
||||
|
||||
/* the unit for bytes */
|
||||
"B" = "B";
|
||||
|
||||
@@ -65,6 +69,8 @@
|
||||
|
||||
"Should %1$@ automatically check for updates? You can always check for updates manually from the %1$@ menu." = "Soll %1$@ automatisch nach Aktualisierungen suchen? Sie können im %1$@-Menü auch manuell nach Aktualisierungen suchen.";
|
||||
|
||||
"The update is improperly signed." = "Die Aktualisierung ist nicht ordnungsgemäß signiert.";
|
||||
|
||||
"Update Error!" = "Fehler beim Aktualisieren!";
|
||||
|
||||
"Updating %@" = "Aktualisierung von %@";
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="width" priority="800" constant="64" id="QhW-E9-8Br"/>
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
|
||||
</constraints>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="168"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
|
||||
</connections>
|
||||
|
||||
@@ -54,7 +54,7 @@ static NSString * const UPDATED_VERSION = @"2.0";
|
||||
assert(bundleIdentifier != nil);
|
||||
|
||||
// Create a directory that'll be used for our web server listing
|
||||
NSURL *serverDirectoryURL = [cacheDirectoryURL URLByAppendingPathComponent:bundleIdentifier];
|
||||
NSURL *serverDirectoryURL = [[cacheDirectoryURL URLByAppendingPathComponent:bundleIdentifier] URLByAppendingPathComponent:@"ServerData"];
|
||||
if ([serverDirectoryURL checkResourceIsReachableAndReturnError:nil]) {
|
||||
NSError *removeServerDirectoryError = nil;
|
||||
|
||||
@@ -73,7 +73,10 @@ static NSString * const UPDATED_VERSION = @"2.0";
|
||||
assert(bundleURL != nil);
|
||||
|
||||
// Copy main bundle into server directory
|
||||
NSURL *destinationBundleURL = [serverDirectoryURL URLByAppendingPathComponent:bundleURL.lastPathComponent];
|
||||
NSString *bundleURLLastComponent = bundleURL.lastPathComponent;
|
||||
assert(bundleURLLastComponent != nil);
|
||||
|
||||
NSURL *destinationBundleURL = [serverDirectoryURL URLByAppendingPathComponent:bundleURLLastComponent];
|
||||
NSError *copyBundleError = nil;
|
||||
if (![fileManager copyItemAtURL:bundleURL toURL:destinationBundleURL error:©BundleError]) {
|
||||
NSLog(@"Failed to copy main bundle into server directory with error %@", copyBundleError);
|
||||
@@ -87,8 +90,8 @@ static NSString * const UPDATED_VERSION = @"2.0";
|
||||
assert(infoFileExists);
|
||||
|
||||
NSMutableDictionary *infoDictionary = [[NSMutableDictionary alloc] initWithContentsOfURL:infoURL];
|
||||
infoDictionary[(__bridge NSString *)kCFBundleVersionKey] = UPDATED_VERSION;
|
||||
infoDictionary[@"CFBundleShortVersionString"] = UPDATED_VERSION;
|
||||
[infoDictionary setObject:UPDATED_VERSION forKey:(__bridge NSString *)kCFBundleVersionKey];
|
||||
[infoDictionary setObject:UPDATED_VERSION forKey:@"CFBundleShortVersionString"];
|
||||
|
||||
BOOL wroteInfoFile = [infoDictionary writeToURL:infoURL atomically:NO];
|
||||
assert(wroteInfoFile);
|
||||
@@ -139,7 +142,9 @@ static NSString * const UPDATED_VERSION = @"2.0";
|
||||
|
||||
// Obtain the file attributes to get the file size of our update later
|
||||
NSError *fileAttributesError = nil;
|
||||
NSDictionary *archiveFileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:archiveURL.path error:&fileAttributesError];
|
||||
NSString *archivePath = archiveURL.path;
|
||||
assert(archivePath != nil);
|
||||
NSDictionary *archiveFileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:archivePath error:&fileAttributesError];
|
||||
if (archiveFileAttributes == nil) {
|
||||
NSLog(@"Failed to retrieve file attributes from archive with error %@", fileAttributesError);
|
||||
assert(NO);
|
||||
|
||||
@@ -93,12 +93,12 @@
|
||||
if (numBytes > 0) {
|
||||
NSString *request = [[NSString alloc] initWithBytes:buffer length:(NSUInteger)numBytes encoding:NSUTF8StringEncoding];
|
||||
NSArray *lines = [request componentsSeparatedByString:@"\r\n"];
|
||||
NSString *requestLine = lines.count >= 3 ? lines[0] : nil;
|
||||
NSString *requestLine = lines.count >= 3 ? [lines objectAtIndex:0] : nil;
|
||||
NSArray *parts = requestLine ? [requestLine componentsSeparatedByString:@" "] : nil;
|
||||
// Only process GET requests for existing files
|
||||
if ([parts[0] isEqualToString:@"GET"]) {
|
||||
if ([[parts objectAtIndex:0] isEqualToString:@"GET"]) {
|
||||
// Use NSURL to strip out query parameters
|
||||
NSString *path = [NSURL URLWithString:parts[1] relativeToURL:nil].path;
|
||||
NSString *path = [NSURL URLWithString:[parts objectAtIndex:1] relativeToURL:nil].path;
|
||||
NSString *filePath = [self.workingDirectory stringByAppendingString:path];
|
||||
BOOL isDir = NO;
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:filePath isDirectory:&isDir] || isDir) {
|
||||
|
||||
@@ -8,10 +8,38 @@
|
||||
<pubDate>Sat, 26 Jul 2014 15:20:11 +0000</pubDate>
|
||||
<enclosure url="http://0.0.0.0:1337/Sparkle_Test_App.zip" sparkle:version="2.0" />
|
||||
</item>
|
||||
<!-- The best chosen release -->
|
||||
<item>
|
||||
<title>Version 3.0</title>
|
||||
<pubDate>Sat, 26 Jul 2014 15:20:12 +0000</pubDate>
|
||||
<enclosure url="http://0.0.0.0:1337/Sparkle_Test_App.zip" sparkle:version="3.0" />
|
||||
<sparkle:deltas>
|
||||
<enclosure url="http://0.0.0.0:1337/3.0_from_2.0.patch"
|
||||
sparkle:version="3.0"
|
||||
sparkle:deltaFrom="2.0"
|
||||
length="1235"
|
||||
type="application/octet-stream"
|
||||
sparkle:dsaSignature="..." />
|
||||
|
||||
<enclosure url="http://0.0.0.0:1337/3.0_from_1.0.patch"
|
||||
sparkle:version="3.0"
|
||||
sparkle:deltaFrom="1.0"
|
||||
length="1485"
|
||||
type="application/octet-stream"
|
||||
sparkle:dsaSignature="..." />
|
||||
</sparkle:deltas>
|
||||
</item>
|
||||
<!-- A release testing minimumSystemVersion -->
|
||||
<item>
|
||||
<title>Version 4.0</title>
|
||||
<pubDate>Sat, 26 Jul 2014 15:20:13 +0000</pubDate>
|
||||
<enclosure url="http://0.0.0.0:1337/Sparkle_Test_App.zip" sparkle:version="4.0" />
|
||||
<sparkle:minimumSystemVersion>17.0.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
<!-- A joke release testing maximumSystemVersion -->
|
||||
<item>
|
||||
<title>Version 5.0</title>
|
||||
<enclosure url="http://0.0.0.0:1337/Sparkle_Test_App.zip" sparkle:version="5.0" />
|
||||
<sparkle:maximumSystemVersion>2.0.0</sparkle:maximumSystemVersion>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
||||
@@ -20,12 +20,43 @@ class SUAppcastTest: XCTestCase {
|
||||
do {
|
||||
let items = try appcast.parseAppcastItemsFromXMLFile(testFileUrl) as! [SUAppcastItem];
|
||||
|
||||
XCTAssertEqual(2, items.count);
|
||||
XCTAssertEqual("Version 3.0", items[0].title);
|
||||
XCTAssertNil(items[0].itemDescription);
|
||||
XCTAssertEqual(4, items.count);
|
||||
|
||||
XCTAssertEqual("Version 2.0", items[1].title);
|
||||
XCTAssertEqual("desc", items[1].itemDescription);
|
||||
XCTAssertEqual("Version 2.0", items[0].title);
|
||||
XCTAssertEqual("desc", items[0].itemDescription);
|
||||
XCTAssertEqual("Sat, 26 Jul 2014 15:20:11 +0000", items[0].dateString)
|
||||
|
||||
// This is the best release matching our system version
|
||||
XCTAssertEqual("Version 3.0", items[1].title);
|
||||
XCTAssertNil(items[1].itemDescription);
|
||||
XCTAssertNil(items[1].dateString)
|
||||
|
||||
XCTAssertEqual("Version 4.0", items[2].title);
|
||||
XCTAssertNil(items[2].itemDescription);
|
||||
XCTAssertEqual("Sat, 26 Jul 2014 15:20:13 +0000", items[2].dateString)
|
||||
|
||||
XCTAssertEqual("Version 5.0", items[3].title);
|
||||
XCTAssertNil(items[3].itemDescription);
|
||||
XCTAssertNil(items[3].dateString)
|
||||
|
||||
// Test best appcast item & a delta update item
|
||||
var deltaItem: SUAppcastItem? = nil
|
||||
let bestAppcastItem = SUBasicUpdateDriver.bestItemFromAppcastItems(items, getDeltaItem: &deltaItem, withHostVersion: "1.0", comparator: SUStandardVersionComparator.defaultComparator())
|
||||
|
||||
XCTAssertEqual(bestAppcastItem, items[1])
|
||||
XCTAssertEqual(deltaItem!.fileURL.lastPathComponent, "3.0_from_1.0.patch")
|
||||
|
||||
// Test latest delta update item available
|
||||
var latestDeltaItem: SUAppcastItem? = nil
|
||||
SUBasicUpdateDriver.bestItemFromAppcastItems(items, getDeltaItem: &latestDeltaItem, withHostVersion: "2.0", comparator: SUStandardVersionComparator.defaultComparator())
|
||||
|
||||
XCTAssertEqual(latestDeltaItem!.fileURL.lastPathComponent, "3.0_from_2.0.patch")
|
||||
|
||||
// Test a delta item that does not exist
|
||||
var nonexistantDeltaItem: SUAppcastItem? = nil
|
||||
SUBasicUpdateDriver.bestItemFromAppcastItems(items, getDeltaItem: &nonexistantDeltaItem, withHostVersion: "2.1", comparator: SUStandardVersionComparator.defaultComparator())
|
||||
|
||||
XCTAssertNil(nonexistantDeltaItem)
|
||||
} catch let err as NSError {
|
||||
NSLog("%@", err);
|
||||
XCTFail(err.localizedDescription);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#import <XCTest/XCTest.h>
|
||||
#import "NTSynchronousTask.h"
|
||||
#import "SUCodeSigningVerifier.h"
|
||||
#import "SUFileManager.h"
|
||||
|
||||
@interface SUCodeSigningVerifierTest : XCTestCase
|
||||
|
||||
@@ -32,11 +33,24 @@
|
||||
NSBundle *unitTestBundle = [NSBundle bundleForClass:[self class]];
|
||||
NSString *unitTestBundleIdentifier = unitTestBundle.bundleIdentifier;
|
||||
NSString *zippedAppPath = [unitTestBundle pathForResource:@"SparkleTestCodeSignApp" ofType:@"zip"];
|
||||
NSString *tempDir = [NSTemporaryDirectory() stringByAppendingPathComponent:unitTestBundleIdentifier];
|
||||
|
||||
SUFileManager *fileManager = [SUFileManager fileManagerAllowingAuthorization:NO];
|
||||
|
||||
NSError *tempError = nil;
|
||||
NSURL *tempDir = [fileManager makeTemporaryDirectoryWithPreferredName:unitTestBundleIdentifier appropriateForDirectoryURL:[NSURL fileURLWithPath:zippedAppPath] error:&tempError];
|
||||
|
||||
if (tempDir == nil) {
|
||||
XCTFail(@"Failed to create temporary directory with error: %@", tempError);
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *tempDirPath = tempDir.path;
|
||||
XCTAssertNotNil(tempDirPath);
|
||||
|
||||
NSError *error = nil;
|
||||
if ([[NSFileManager defaultManager] createDirectoryAtPath:tempDir withIntermediateDirectories:YES attributes:nil error:&error]) {
|
||||
if ([self unzip:zippedAppPath toPath:tempDir]) {
|
||||
self.notSignedAppPath = [tempDir stringByAppendingPathComponent:@"SparkleTestCodeSignApp.app"];
|
||||
if ([[NSFileManager defaultManager] createDirectoryAtPath:tempDirPath withIntermediateDirectories:YES attributes:nil error:&error]) {
|
||||
if ([self unzip:zippedAppPath toPath:tempDirPath]) {
|
||||
self.notSignedAppPath = [tempDirPath stringByAppendingPathComponent:@"SparkleTestCodeSignApp.app"];
|
||||
[self setupValidSignedApp];
|
||||
[self setupInvalidSignedApp];
|
||||
}
|
||||
@@ -54,13 +68,8 @@
|
||||
[super tearDown];
|
||||
|
||||
if (self.notSignedAppPath) {
|
||||
[[NSFileManager defaultManager] removeItemAtPath:self.notSignedAppPath error:nil];
|
||||
}
|
||||
if (self.validSignedAppPath) {
|
||||
[[NSFileManager defaultManager] removeItemAtPath:self.validSignedAppPath error:nil];
|
||||
}
|
||||
if (self.invalidSignedAppPath) {
|
||||
[[NSFileManager defaultManager] removeItemAtPath:self.invalidSignedAppPath error:nil];
|
||||
NSString *tempDir = [self.notSignedAppPath stringByDeletingLastPathComponent];
|
||||
[[NSFileManager defaultManager] removeItemAtPath:tempDir error:nil];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +78,10 @@
|
||||
NSError *error = nil;
|
||||
NSString *tempDir = [self.notSignedAppPath stringByDeletingLastPathComponent];
|
||||
NSString *signedAndValid = [tempDir stringByAppendingPathComponent:@"valid-signed.app"];
|
||||
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:signedAndValid]) {
|
||||
[[NSFileManager defaultManager] removeItemAtPath:signedAndValid error:NULL];
|
||||
}
|
||||
if ([[NSFileManager defaultManager] copyItemAtPath:self.notSignedAppPath toPath:signedAndValid error:&error]) {
|
||||
self.validSignedAppPath = signedAndValid;
|
||||
if (![self codesignAppPath:self.validSignedAppPath]) {
|
||||
@@ -85,6 +98,10 @@
|
||||
NSError *error = nil;
|
||||
NSString *tempDir = [self.notSignedAppPath stringByDeletingLastPathComponent];
|
||||
NSString *signedAndInvalid = [tempDir stringByAppendingPathComponent:@"invalid-signed.app"];
|
||||
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:signedAndInvalid]) {
|
||||
[[NSFileManager defaultManager] removeItemAtPath:signedAndInvalid error:NULL];
|
||||
}
|
||||
if ([[NSFileManager defaultManager] copyItemAtPath:self.notSignedAppPath toPath:signedAndInvalid error:&error]) {
|
||||
self.invalidSignedAppPath = signedAndInvalid;
|
||||
if ([self codesignAppPath:self.invalidSignedAppPath]) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import XCTest
|
||||
|
||||
class SUFileManagerTest: XCTestCase
|
||||
{
|
||||
func makeTempFiles(testBlock: (SUFileManager, NSURL, NSURL, NSURL, NSURL) -> Void)
|
||||
func makeTempFiles(testBlock: (SUFileManager, NSURL, NSURL, NSURL, NSURL, NSURL, NSURL) -> Void)
|
||||
{
|
||||
let fileManager = SUFileManager(allowingAuthorization: false)
|
||||
|
||||
@@ -29,12 +29,18 @@ class SUFileManagerTest: XCTestCase
|
||||
let fileInDirectoryURL = directoryURL.URLByAppendingPathComponent("a file inside a directory written by sparkles unit tests")
|
||||
try! "bar baz".dataUsingEncoding(NSUTF8StringEncoding)!.writeToURL(fileInDirectoryURL, options: .DataWritingAtomic)
|
||||
|
||||
testBlock(fileManager, tempDirectoryURL, ordinaryFileURL, directoryURL, fileInDirectoryURL)
|
||||
let validSymlinkURL = tempDirectoryURL.URLByAppendingPathComponent("symlink test")
|
||||
try! NSFileManager.defaultManager().createSymbolicLinkAtURL(validSymlinkURL, withDestinationURL: directoryURL)
|
||||
|
||||
let invalidSymlinkURL = tempDirectoryURL.URLByAppendingPathComponent("symlink test 2")
|
||||
try! NSFileManager.defaultManager().createSymbolicLinkAtURL(invalidSymlinkURL, withDestinationURL: tempDirectoryURL.URLByAppendingPathComponent("does not exist"))
|
||||
|
||||
testBlock(fileManager, tempDirectoryURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, invalidSymlinkURL)
|
||||
}
|
||||
|
||||
func testMoveFiles()
|
||||
{
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL in
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, invalidSymlinkURL in
|
||||
XCTAssertNil(try? fileManager.moveItemAtURL(ordinaryFileURL, toURL: directoryURL))
|
||||
XCTAssertNil(try? fileManager.moveItemAtURL(ordinaryFileURL, toURL: directoryURL.URLByAppendingPathComponent("foo").URLByAppendingPathComponent("bar")))
|
||||
XCTAssertNil(try? fileManager.moveItemAtURL(rootURL.URLByAppendingPathComponent("does not exist"), toURL: directoryURL))
|
||||
@@ -44,6 +50,17 @@ class SUFileManagerTest: XCTestCase
|
||||
XCTAssertFalse(fileManager._itemExistsAtURL(ordinaryFileURL))
|
||||
XCTAssertTrue(fileManager._itemExistsAtURL(newFileURL))
|
||||
|
||||
let newValidSymlinkURL = (ordinaryFileURL.URLByDeletingLastPathComponent?.URLByAppendingPathComponent("new symlink"))!
|
||||
try! fileManager.moveItemAtURL(validSymlinkURL, toURL: newValidSymlinkURL)
|
||||
XCTAssertFalse(fileManager._itemExistsAtURL(validSymlinkURL))
|
||||
XCTAssertTrue(fileManager._itemExistsAtURL(newValidSymlinkURL))
|
||||
XCTAssertTrue(fileManager._itemExistsAtURL(directoryURL))
|
||||
|
||||
let newInvalidSymlinkURL = (ordinaryFileURL.URLByDeletingLastPathComponent?.URLByAppendingPathComponent("new invalid symlink"))!
|
||||
try! fileManager.moveItemAtURL(invalidSymlinkURL, toURL: newInvalidSymlinkURL)
|
||||
XCTAssertFalse(fileManager._itemExistsAtURL(invalidSymlinkURL))
|
||||
XCTAssertTrue(fileManager._itemExistsAtURL(newValidSymlinkURL))
|
||||
|
||||
let newDirectoryURL = (ordinaryFileURL.URLByDeletingLastPathComponent?.URLByAppendingPathComponent("new directory"))!
|
||||
try! fileManager.moveItemAtURL(directoryURL, toURL: newDirectoryURL)
|
||||
XCTAssertFalse(fileManager._itemExistsAtURL(directoryURL))
|
||||
@@ -55,7 +72,7 @@ class SUFileManagerTest: XCTestCase
|
||||
|
||||
func testMoveFilesToTrash()
|
||||
{
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL in
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, invalidSymlinkURL in
|
||||
XCTAssertNil(try? fileManager.moveItemAtURLToTrash(rootURL.URLByAppendingPathComponent("does not exist")))
|
||||
|
||||
let trashURL = try! NSFileManager.defaultManager().URLForDirectory(.TrashDirectory, inDomain: .UserDomainMask, appropriateForURL: nil, create: false)
|
||||
@@ -67,6 +84,12 @@ class SUFileManagerTest: XCTestCase
|
||||
XCTAssertTrue(fileManager._itemExistsAtURL(ordinaryFileTrashURL))
|
||||
try! fileManager.removeItemAtURL(ordinaryFileTrashURL)
|
||||
|
||||
let validSymlinkTrashURL = trashURL.URLByAppendingPathComponent(validSymlinkURL.lastPathComponent!)
|
||||
try! fileManager.moveItemAtURLToTrash(validSymlinkURL)
|
||||
XCTAssertTrue(fileManager._itemExistsAtURL(validSymlinkTrashURL))
|
||||
XCTAssertTrue(fileManager._itemExistsAtURL(directoryURL))
|
||||
try! fileManager.removeItemAtURL(validSymlinkTrashURL)
|
||||
|
||||
try! fileManager.moveItemAtURLToTrash(directoryURL)
|
||||
XCTAssertFalse(fileManager._itemExistsAtURL(directoryURL))
|
||||
XCTAssertFalse(fileManager._itemExistsAtURL(fileInDirectoryURL))
|
||||
@@ -81,7 +104,7 @@ class SUFileManagerTest: XCTestCase
|
||||
|
||||
func testCopyFiles()
|
||||
{
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL in
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, invalidSymlinkURL in
|
||||
XCTAssertNil(try? fileManager.copyItemAtURL(ordinaryFileURL, toURL: directoryURL))
|
||||
XCTAssertNil(try? fileManager.copyItemAtURL(ordinaryFileURL, toURL: directoryURL.URLByAppendingPathComponent("foo").URLByAppendingPathComponent("bar")))
|
||||
XCTAssertNil(try? fileManager.copyItemAtURL(rootURL.URLByAppendingPathComponent("does not exist"), toURL: directoryURL))
|
||||
@@ -91,6 +114,10 @@ class SUFileManagerTest: XCTestCase
|
||||
XCTAssertTrue(fileManager._itemExistsAtURL(ordinaryFileURL))
|
||||
XCTAssertTrue(fileManager._itemExistsAtURL(newFileURL))
|
||||
|
||||
let newSymlinkURL = (ordinaryFileURL.URLByDeletingLastPathComponent?.URLByAppendingPathComponent("new symlink file"))!
|
||||
try! fileManager.copyItemAtURL(invalidSymlinkURL, toURL: newSymlinkURL)
|
||||
XCTAssertTrue(fileManager._itemExistsAtURL(newSymlinkURL))
|
||||
|
||||
let newDirectoryURL = (ordinaryFileURL.URLByDeletingLastPathComponent?.URLByAppendingPathComponent("new directory"))!
|
||||
try! fileManager.copyItemAtURL(directoryURL, toURL: newDirectoryURL)
|
||||
XCTAssertTrue(fileManager._itemExistsAtURL(directoryURL))
|
||||
@@ -102,12 +129,16 @@ class SUFileManagerTest: XCTestCase
|
||||
|
||||
func testRemoveFiles()
|
||||
{
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL in
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, invalidSymlinkURL in
|
||||
XCTAssertNil(try? fileManager.removeItemAtURL(rootURL.URLByAppendingPathComponent("does not exist")))
|
||||
|
||||
try! fileManager.removeItemAtURL(ordinaryFileURL)
|
||||
XCTAssertFalse(fileManager._itemExistsAtURL(ordinaryFileURL))
|
||||
|
||||
try! fileManager.removeItemAtURL(validSymlinkURL)
|
||||
XCTAssertFalse(fileManager._itemExistsAtURL(validSymlinkURL))
|
||||
XCTAssertTrue(fileManager._itemExistsAtURL(directoryURL))
|
||||
|
||||
try! fileManager.removeItemAtURL(directoryURL)
|
||||
XCTAssertFalse(fileManager._itemExistsAtURL(directoryURL))
|
||||
XCTAssertFalse(fileManager._itemExistsAtURL(fileInDirectoryURL))
|
||||
@@ -116,9 +147,10 @@ class SUFileManagerTest: XCTestCase
|
||||
|
||||
func testReleaseFilesFromQuarantine()
|
||||
{
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL in
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, invalidSymlinkURL in
|
||||
try! fileManager.releaseItemFromQuarantineAtRootURL(ordinaryFileURL)
|
||||
try! fileManager.releaseItemFromQuarantineAtRootURL(directoryURL)
|
||||
try! fileManager.releaseItemFromQuarantineAtRootURL(validSymlinkURL)
|
||||
|
||||
let quarantineData = "does not really matter what is here".cStringUsingEncoding(NSUTF8StringEncoding)!
|
||||
let quarantineDataLength = Int(strlen(quarantineData))
|
||||
@@ -135,6 +167,11 @@ class SUFileManagerTest: XCTestCase
|
||||
XCTAssertEqual(0, setxattr(fileInDirectoryURL.path!, SUAppleQuarantineIdentifier, quarantineData, quarantineDataLength, 0, XATTR_CREATE))
|
||||
XCTAssertGreaterThan(getxattr(fileInDirectoryURL.path!, SUAppleQuarantineIdentifier, nil, 0, 0, XATTR_NOFOLLOW), 0)
|
||||
|
||||
// Extended attributes can't be set on symbolic links in OS X, currently
|
||||
try! fileManager.releaseItemFromQuarantineAtRootURL(validSymlinkURL)
|
||||
XCTAssertGreaterThan(getxattr(directoryURL.path!, SUAppleQuarantineIdentifier, nil, 0, 0, XATTR_NOFOLLOW), 0)
|
||||
XCTAssertEqual(-1, getxattr(validSymlinkURL.path!, SUAppleQuarantineIdentifier, nil, 0, 0, XATTR_NOFOLLOW))
|
||||
|
||||
try! fileManager.releaseItemFromQuarantineAtRootURL(directoryURL)
|
||||
|
||||
XCTAssertEqual(-1, getxattr(directoryURL.path!, SUAppleQuarantineIdentifier, nil, 0, 0, XATTR_NOFOLLOW))
|
||||
@@ -153,7 +190,7 @@ class SUFileManagerTest: XCTestCase
|
||||
// Instead we try to change the group ID - we just have to be a member of that group
|
||||
func testAlterFilesGroupID()
|
||||
{
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL in
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, invalidSymlinkURL in
|
||||
XCTAssertNil(try? fileManager.changeOwnerAndGroupOfItemAtRootURL(ordinaryFileURL, toMatchURL: rootURL.URLByAppendingPathComponent("does not exist")))
|
||||
|
||||
XCTAssertNil(try? fileManager.changeOwnerAndGroupOfItemAtRootURL(rootURL.URLByAppendingPathComponent("does not exist"), toMatchURL: ordinaryFileURL))
|
||||
@@ -169,12 +206,15 @@ class SUFileManagerTest: XCTestCase
|
||||
XCTAssertEqual(staffGroupID, self.groupIDAtPath(ordinaryFileURL.path!))
|
||||
XCTAssertEqual(staffGroupID, self.groupIDAtPath(directoryURL.path!))
|
||||
XCTAssertEqual(staffGroupID, self.groupIDAtPath(fileInDirectoryURL.path!))
|
||||
|
||||
XCTAssertEqual(staffGroupID, self.groupIDAtPath(validSymlinkURL.path!))
|
||||
|
||||
try! fileManager.changeOwnerAndGroupOfItemAtRootURL(fileInDirectoryURL, toMatchURL: ordinaryFileURL)
|
||||
try! fileManager.changeOwnerAndGroupOfItemAtRootURL(ordinaryFileURL, toMatchURL: ordinaryFileURL)
|
||||
try! fileManager.changeOwnerAndGroupOfItemAtRootURL(validSymlinkURL, toMatchURL: ordinaryFileURL)
|
||||
|
||||
XCTAssertEqual(staffGroupID, self.groupIDAtPath(ordinaryFileURL.path!))
|
||||
XCTAssertEqual(staffGroupID, self.groupIDAtPath(directoryURL.path!))
|
||||
XCTAssertEqual(staffGroupID, self.groupIDAtPath(validSymlinkURL.path!))
|
||||
|
||||
XCTAssertEqual(0, chown(ordinaryFileURL.path!, getuid(), everyoneGroupID))
|
||||
XCTAssertEqual(everyoneGroupID, self.groupIDAtPath(ordinaryFileURL.path!))
|
||||
@@ -185,6 +225,9 @@ class SUFileManagerTest: XCTestCase
|
||||
try! fileManager.changeOwnerAndGroupOfItemAtRootURL(fileInDirectoryURL, toMatchURL: directoryURL)
|
||||
XCTAssertEqual(staffGroupID, self.groupIDAtPath(fileInDirectoryURL.path!))
|
||||
|
||||
try! fileManager.changeOwnerAndGroupOfItemAtRootURL(validSymlinkURL, toMatchURL: ordinaryFileURL)
|
||||
XCTAssertEqual(everyoneGroupID, self.groupIDAtPath(validSymlinkURL.path!))
|
||||
|
||||
try! fileManager.changeOwnerAndGroupOfItemAtRootURL(directoryURL, toMatchURL: ordinaryFileURL)
|
||||
XCTAssertEqual(everyoneGroupID, self.groupIDAtPath(directoryURL.path!))
|
||||
XCTAssertEqual(everyoneGroupID, self.groupIDAtPath(fileInDirectoryURL.path!))
|
||||
@@ -193,28 +236,33 @@ class SUFileManagerTest: XCTestCase
|
||||
|
||||
func testUpdateFileModificationTime()
|
||||
{
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL in
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, invalidSymlinkURL in
|
||||
XCTAssertNil(try? fileManager.updateModificationAndAccessTimeOfItemAtURL(rootURL.URLByAppendingPathComponent("does not exist")))
|
||||
|
||||
let oldOrdinaryFileAttributes = try! NSFileManager.defaultManager().attributesOfItemAtPath(ordinaryFileURL.path!)
|
||||
let oldDirectoryAttributes = try! NSFileManager.defaultManager().attributesOfItemAtPath(directoryURL.path!)
|
||||
let oldValidSymlinkAttributes = try! NSFileManager.defaultManager().attributesOfItemAtPath(validSymlinkURL.path!)
|
||||
|
||||
sleep(1); // wait for clock to advance
|
||||
|
||||
try! fileManager.updateModificationAndAccessTimeOfItemAtURL(ordinaryFileURL)
|
||||
try! fileManager.updateModificationAndAccessTimeOfItemAtURL(directoryURL)
|
||||
try! fileManager.updateModificationAndAccessTimeOfItemAtURL(validSymlinkURL)
|
||||
|
||||
let newOrdinaryFileAttributes = try! NSFileManager.defaultManager().attributesOfItemAtPath(ordinaryFileURL.path!)
|
||||
XCTAssertGreaterThan((newOrdinaryFileAttributes[NSFileModificationDate] as! NSDate).timeIntervalSinceDate(oldOrdinaryFileAttributes[NSFileModificationDate] as! NSDate), 0)
|
||||
|
||||
let newDirectoryAttributes = try! NSFileManager.defaultManager().attributesOfItemAtPath(directoryURL.path!)
|
||||
XCTAssertGreaterThan((newDirectoryAttributes[NSFileModificationDate] as! NSDate).timeIntervalSinceDate(oldDirectoryAttributes[NSFileModificationDate] as! NSDate), 0)
|
||||
|
||||
let newSymlinkAttributes = try! NSFileManager.defaultManager().attributesOfItemAtPath(validSymlinkURL.path!)
|
||||
XCTAssertGreaterThan((newSymlinkAttributes[NSFileModificationDate] as! NSDate).timeIntervalSinceDate(oldValidSymlinkAttributes[NSFileModificationDate] as! NSDate), 0)
|
||||
}
|
||||
}
|
||||
|
||||
func testFileExists()
|
||||
{
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL in
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, invalidSymlinkURL in
|
||||
XCTAssertTrue(fileManager._itemExistsAtURL(ordinaryFileURL))
|
||||
XCTAssertTrue(fileManager._itemExistsAtURL(directoryURL))
|
||||
XCTAssertFalse(fileManager._itemExistsAtURL(rootURL.URLByAppendingPathComponent("does not exist")))
|
||||
@@ -227,17 +275,11 @@ class SUFileManagerTest: XCTestCase
|
||||
|
||||
XCTAssertFalse(fileManager._itemExistsAtURL(rootURL.URLByAppendingPathComponent("does not exist"), isDirectory: nil))
|
||||
|
||||
let validSymlinkURL = rootURL.URLByAppendingPathComponent("symlink test")
|
||||
try! NSFileManager.defaultManager().createSymbolicLinkAtURL(validSymlinkURL, withDestinationURL: directoryURL)
|
||||
|
||||
XCTAssertTrue(fileManager._itemExistsAtURL(validSymlinkURL))
|
||||
|
||||
var validSymlinkIsADirectory: ObjCBool = false
|
||||
XCTAssertTrue(fileManager._itemExistsAtURL(validSymlinkURL, isDirectory: &validSymlinkIsADirectory) && !validSymlinkIsADirectory)
|
||||
|
||||
let invalidSymlinkURL = rootURL.URLByAppendingPathComponent("symlink test 2")
|
||||
try! NSFileManager.defaultManager().createSymbolicLinkAtURL(invalidSymlinkURL, withDestinationURL: rootURL.URLByAppendingPathComponent("does not exist"))
|
||||
|
||||
// Symlink should still exist even if it doesn't point to a file that exists
|
||||
XCTAssertTrue(fileManager._itemExistsAtURL(invalidSymlinkURL))
|
||||
|
||||
@@ -248,7 +290,7 @@ class SUFileManagerTest: XCTestCase
|
||||
|
||||
func testMakeDirectory()
|
||||
{
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL in
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, invalidSymlinkURL in
|
||||
XCTAssertNil(try? fileManager._makeDirectoryAtURL(ordinaryFileURL))
|
||||
XCTAssertNil(try? fileManager._makeDirectoryAtURL(directoryURL))
|
||||
|
||||
@@ -260,6 +302,9 @@ class SUFileManagerTest: XCTestCase
|
||||
|
||||
var isDirectory: ObjCBool = false
|
||||
XCTAssertTrue(fileManager._itemExistsAtURL(newDirectoryURL, isDirectory: &isDirectory))
|
||||
|
||||
try! fileManager.removeItemAtURL(directoryURL)
|
||||
XCTAssertNil(try? fileManager._makeDirectoryAtURL(validSymlinkURL))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
{
|
||||
[super setUp];
|
||||
self.queue = [[NSOperationQueue alloc] init];
|
||||
self.updater = [[SUUpdater alloc] init];
|
||||
self.updater = [[SUUpdater alloc] initForBundle:[NSBundle bundleForClass:[self class]]];
|
||||
self.updater.delegate = self;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
#import "SUFileManager.h"
|
||||
#import "SUAppcast.h"
|
||||
#import "SUAppcastItem.h"
|
||||
#import "SUBasicUpdateDriver.h"
|
||||
#import "SUVersionComparisonProtocol.h"
|
||||
#import "SUStandardVersionComparator.h"
|
||||
|
||||
// Duplicated to avoid exporting a private symbol from SUFileManager
|
||||
static const char *SUAppleQuarantineIdentifier = "com.apple.quarantine";
|
||||
@@ -23,6 +26,12 @@ static const char *SUAppleQuarantineIdentifier = "com.apple.quarantine";
|
||||
|
||||
@end
|
||||
|
||||
@interface SUBasicUpdateDriver (Private)
|
||||
|
||||
+ (SUAppcastItem *)bestItemFromAppcastItems:(NSArray *)appcastItems getDeltaItem:(SUAppcastItem * __autoreleasing *)deltaItem withHostVersion:(NSString *)hostVersion comparator:(id<SUVersionComparison>)comparator;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface SUAppcast (Private)
|
||||
- (NSArray *)parseAppcastItemsFromXMLFile:(NSURL *)appcastFile error:(NSError *__autoreleasing*)errorp;
|
||||
|
||||
@@ -16,5 +16,11 @@
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>SUEnableAutomaticChecks</key>
|
||||
<true/>
|
||||
<key>SUEnableSystemProfiling</key>
|
||||
<false/>
|
||||
<key>SUPublicDSAKeyFile</key>
|
||||
<string>test-pubkey.pem</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
- (void)taskOutputAvailable:(NSNotification*)note
|
||||
{
|
||||
self.output = [note userInfo][NSFileHandleNotificationDataItem];
|
||||
self.output = [[note userInfo] objectForKey:NSFileHandleNotificationDataItem];
|
||||
|
||||
self.done = YES;
|
||||
}
|
||||
|
||||