Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter for archive files in generate_appcast more intelligently #2448

Merged
merged 3 commits into from
Oct 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Autoupdate/SUPipedUnarchiver.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ @implementation SUPipedUnarchiver
NSArray <NSString *> *extractTBZ = @[@"/usr/bin/tar", @"-jxC"];
NSArray <NSString *> *extractTXZ = extractTGZ;

// Note: keep this list in sync with generate_appcast's unarchiveUpdates()
NSDictionary <NSString *, NSArray<NSString *> *> *extractCommandDictionary =
@{
@".zip" : @[@"/usr/bin/ditto", @"-x",@"-k",@"-"],
Expand Down
13 changes: 12 additions & 1 deletion generate_appcast/Unarchive.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,18 @@ func unarchiveUpdates(archivesSourceDir: URL, archivesDestDir: URL, disableNeste
// so we can ignore duplicate archive entries before trying to unarchive archives in parallel
var fileEntries: [URL: URL] = [:]
let dir = try fileManager.contentsOfDirectory(atPath: archivesSourceDir.path)
for item in dir.filter({ !$0.hasPrefix(".") && !$0.hasSuffix(".delta") && !$0.hasSuffix(".xml") && !$0.hasSuffix(".html") && !$0.hasSuffix(".txt") }) {
for item in dir {
if item.hasPrefix(".") {
continue
}

let itemURL = archivesSourceDir.appendingPathComponent(item)
let fileExtension = itemURL.pathExtension
// Note: keep this list in sync with SUPipedUnarchiver
guard ["zip", "tar", "gz", "tgz", "bz2", "tbz", "xz", "txz", "lzma", "dmg"].contains(fileExtension) else {
continue
}

let itemPath = archivesSourceDir.appendingPathComponent(item)

// Ignore directories
Expand Down
Loading