Merge pull request #982 from sparkle-project/genapp

Workaround for bugs in NSXMLDocument prefix handling
This commit is contained in:
Kornel authored and GitHub committed 2017-01-07 22:07:56 +00:00
commit f43b9f7f02
3 files changed
+5 -4

No files matched your search

+1 -1
View File
@@ -23,7 +23,7 @@ class DeltaUpdate {
class func create(from: ArchiveItem, to: ArchiveItem, archivePath: URL) throws -> DeltaUpdate {
var applyDiffError: NSError? = nil;
if (!createBinaryDelta(from.appPath.path, to.appPath.path, archivePath.path, .beigeMajorVersion, true, &applyDiffError)) {
if (!createBinaryDelta(from.appPath.path, to.appPath.path, archivePath.path, .beigeMajorVersion, false, &applyDiffError)) {
throw applyDiffError!;
}
+3 -2
View File
@@ -47,7 +47,6 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem]) throws {
XMLNode.Options.nodeLoadExternalEntitiesNever,
XMLNode.Options.nodePreserveCDATA,
XMLNode.Options.nodePreserveWhitespace,
XMLNode.Options.nodePreservePrefixes,
];
doc = try XMLDocument(contentsOf: appcastDestPath, options: Int(options.rawValue));
} catch {
@@ -160,5 +159,7 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem]) throws {
}
let options = XMLNode.Options.nodeCompactEmptyElement;
try doc.xmlData(withOptions:Int(options.rawValue)).write(to: appcastDestPath);
let docData = doc.xmlData(withOptions:Int(options.rawValue));
let _ = try XMLDocument(data: docData, options:0); // Verify that it was generated correctly, which does not always happen!
try docData.write(to: appcastDestPath);
}
+1 -1
View File
@@ -31,7 +31,7 @@ func unarchive(itemPath:URL, archiveDestDir: URL, callback: @escaping (Error?) -
}, progressBlock: nil)
} else {
_ = try? fileManager.removeItem(at: itemCopy);
callback(makeError(code: .unarchivingError, "Can't create a hardlink to \(itemCopy)"));
callback(makeError(code: .unarchivingError, "Not a supported archive format: \(itemCopy)"));
}
} catch {
_ = try? fileManager.removeItem(at: tempDir);