Check for all bundles instead of just apps.

This commit is contained in:
Nate Weaver committed 2019-01-24 11:49:24 -06:00
1 parent a9e20c7d0a
commit d81633a7d3
1 file changed
+8 -2
+8 -2
View File
@@ -69,10 +69,16 @@ class ArchiveItem: CustomStringConvertible {
.filter({ !$0.hasPrefix(".") })
.map({ unarchivedDir.appendingPathComponent($0) })
let apps = items.filter({ $0.pathExtension == "app" });
let apps = items.filter({
if let resourceValues = try? $0.resourceValues(forKeys: [URLResourceKey.typeIdentifierKey]) {
return UTTypeConformsTo(resourceValues.typeIdentifier! as CFString, kUTTypeBundle)
} else {
return false
}
});
if apps.count > 0 {
if apps.count > 1 {
throw makeError(code: .unarchivingError, "Too many apps in \(unarchivedDir.path) \(apps)");
throw makeError(code: .unarchivingError, "Too many bundles in \(unarchivedDir.path) \(apps)");
}
let appPath = apps[0];