From 013e60204dd49e899eb7b9418771d586aa7f8967 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 13 Mar 2016 23:40:23 -0400 Subject: [PATCH 1/2] Don't use subscripting where it may potentially be risky on 10.7 --- Sparkle/Autoupdate/Autoupdate.m | 12 ++++++------ Sparkle/SUAppcast.m | 4 ++-- Sparkle/SUHost.m | 2 +- Sparkle/SUSystemProfiler.m | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Sparkle/Autoupdate/Autoupdate.m b/Sparkle/Autoupdate/Autoupdate.m index ddc60f6c..51b9619a 100644 --- a/Sparkle/Autoupdate/Autoupdate.m +++ b/Sparkle/Autoupdate/Autoupdate.m @@ -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]; diff --git a/Sparkle/SUAppcast.m b/Sparkle/SUAppcast.m index 54b1d2b7..05cba1cd 100644 --- a/Sparkle/SUAppcast.m +++ b/Sparkle/SUAppcast.m @@ -248,9 +248,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]); diff --git a/Sparkle/SUHost.m b/Sparkle/SUHost.m index c49ba368..00ba50d1 100644 --- a/Sparkle/SUHost.m +++ b/Sparkle/SUHost.m @@ -79,7 +79,7 @@ NSArray *cachePaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); NSString *cachePath = nil; if ([cachePaths count]) { - cachePath = cachePaths[0]; + cachePath = [cachePaths objectAtIndex:0]; } if (!cachePath) { SULog(@"Failed to find user's cache directory! Using system default"); diff --git a/Sparkle/SUSystemProfiler.m b/Sparkle/SUSystemProfiler.m index 230c808f..4071da6b 100644 --- a/Sparkle/SUSystemProfiler.m +++ b/Sparkle/SUSystemProfiler.m @@ -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 From 2f724659a777b95e4489d8dc1fd1f16506bf952b Mon Sep 17 00:00:00 2001 From: Sebastian Volland Date: Sat, 19 Mar 2016 18:30:38 +0100 Subject: [PATCH 2/2] Fix german l10n. Update german translation. Update german version of SUAutomaticUpdateAlert.xib (Button widths). Update CheckLocalizations.swift for Swift 2. --- Sparkle/CheckLocalizations.swift | 20 ++++---- Sparkle/de.lproj/SUAutomaticUpdateAlert.xib | 54 +++++++++------------ Sparkle/de.lproj/Sparkle.strings | 8 ++- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/Sparkle/CheckLocalizations.swift b/Sparkle/CheckLocalizations.swift index f0c05797..431e8348 100755 --- a/Sparkle/CheckLocalizations.swift +++ b/Sparkle/CheckLocalizations.swift @@ -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 { diff --git a/Sparkle/de.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/de.lproj/SUAutomaticUpdateAlert.xib index 665268ff..2672e10c 100644 --- a/Sparkle/de.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/de.lproj/SUAutomaticUpdateAlert.xib @@ -1,7 +1,8 @@ - + - + + @@ -14,26 +15,24 @@ - + - + - - + - @@ -44,9 +43,8 @@ - + - @@ -57,9 +55,8 @@ - + - + diff --git a/Sparkle/de.lproj/Sparkle.strings b/Sparkle/de.lproj/Sparkle.strings index 643af47f..1fc6a3d7 100644 --- a/Sparkle/de.lproj/Sparkle.strings +++ b/Sparkle/de.lproj/Sparkle.strings @@ -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 %@";