mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-25 04:47:55 +00:00
Merge branch 'master' into ui-separation-and-xpc
This commit is contained in:
commit
19df2867af
2 files changed
+8
-3
No files matched your search
@@ -5,6 +5,9 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
// Maximum number of delta updates (per OS).
|
||||
let maxDeltas = 5;
|
||||
|
||||
func makeError(code: SUError, _ description: String) -> NSError {
|
||||
return NSError(domain: SUSparkleErrorDomain, code: Int(OSStatus(code.rawValue)), userInfo: [
|
||||
NSLocalizedDescriptionKey: description,
|
||||
@@ -65,7 +68,7 @@ func makeAppcast(archivesSourceDir: URL, privateKey: SecKey) throws -> [String:[
|
||||
continue;
|
||||
}
|
||||
|
||||
let deltaBaseName = appBaseName + item.version + "-" + latestItem.version;
|
||||
let deltaBaseName = appBaseName + latestItem.version + "-" + item.version;
|
||||
let deltaPath = archivesSourceDir.appendingPathComponent(deltaBaseName).appendingPathExtension("delta");
|
||||
|
||||
var delta:DeltaUpdate;
|
||||
@@ -84,7 +87,7 @@ func makeAppcast(archivesSourceDir: URL, privateKey: SecKey) throws -> [String:[
|
||||
if delta.fileSize / 7 < latestItem.fileSize / 8 {
|
||||
// Max 3 deltas per version (arbitrary limit to reduce amount of work)
|
||||
numDeltas += 1;
|
||||
if numDeltas > 3 {
|
||||
if numDeltas > maxDeltas {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
let maxVersionsInFeed = 5;
|
||||
|
||||
func findElement(name: String, parent: XMLElement) -> XMLElement? {
|
||||
if let found = try? parent.nodes(forXPath: name) {
|
||||
if found.count > 0 {
|
||||
@@ -79,7 +81,7 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem]) throws {
|
||||
let createNewItem = existingItems.count == 0;
|
||||
|
||||
// Update all old items, but aim for less than 5 in new feeds
|
||||
if createNewItem && numItems >= 5 {
|
||||
if createNewItem && numItems >= maxVersionsInFeed {
|
||||
continue;
|
||||
}
|
||||
numItems += 1;
|
||||
|
||||
Reference in new issue
Block a user