fix: preview of xcarchive for non app-like bundles
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
<style>__CSS__</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>__QuickLookTitle__</h1>
|
||||
<div class="app __AppInfoHidden__">
|
||||
<h1>__QuickLookTitle__</h1>
|
||||
<div class="floatLeft icon"><img alt="App icon" src="data:image/png;base64,__AppIcon__"/></div>
|
||||
<div class="floatLeft info">
|
||||
Name: <strong>__AppName__</strong><br />
|
||||
|
||||
@@ -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" {
|
||||
|
||||
Reference in New Issue
Block a user