From 8b916829d15ded879f4a9869423df9ad899c7d24 Mon Sep 17 00:00:00 2001 From: relikd Date: Thu, 6 Nov 2025 00:10:10 +0100 Subject: [PATCH] fix: preview of xcarchive for non app-like bundles --- resources/template.html | 2 +- src/MetaInfo.swift | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/resources/template.html b/resources/template.html index 1aa1b80..aa5b6a2 100644 --- a/resources/template.html +++ b/resources/template.html @@ -5,8 +5,8 @@ +

__QuickLookTitle__

-

__QuickLookTitle__

App icon
Name: __AppName__
diff --git a/src/MetaInfo.swift b/src/MetaInfo.swift index a1eec3d..b82dbd4 100644 --- a/src/MetaInfo.swift +++ b/src/MetaInfo.swift @@ -38,11 +38,11 @@ struct MetaInfo { case "com.apple.xcode.archive": self.type = FileType.Archive let productsDir = url.appendingPathComponent("Products", isDirectory: true) - if productsDir.exists() { - if let bundleDir = recursiveSearchInfoPlist(productsDir) { - isOSX = bundleDir.appendingPathComponent("MacOS").exists() && bundleDir.lastPathComponent == "Contents" - effective = bundleDir - } + if productsDir.exists(), let bundleDir = recursiveSearchInfoPlist(productsDir) { + isOSX = bundleDir.appendingPathComponent("MacOS").exists() && bundleDir.lastPathComponent == "Contents" + effective = bundleDir + } else { + effective = productsDir // this is wrong but dont use `url` either because that will find the `Info.plist` of the archive itself } case "com.apple.application-and-system-extension": self.type = FileType.Extension @@ -116,6 +116,9 @@ private func recursiveSearchInfoPlist(_ url: URL) -> URL? { var queue: [URL] = [url] while !queue.isEmpty { let current = queue.removeLast() + if current.pathExtension == "framework" { + continue // do not evaluate bundled frameworks + } if let subfiles = try? FileManager.default.contentsOfDirectory(at: current, includingPropertiesForKeys: []) { for fname in subfiles { if fname.lastPathComponent == "Info.plist" {