Do not treat bundles as executables in codesign check
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Thu, 21 Nov 2024 08:24:52 +0000 (16:24 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Thu, 21 Nov 2024 08:24:52 +0000 (16:24 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
admin/osx/mac-crafter/Sources/Utils/Codesign.swift

index a2b961eb87e3df2653b1ff05586518702aed648c..139a1e802449ceb16de59d1cf9cdaaa554c36222 100644 (file)
@@ -33,7 +33,10 @@ func isAppExtension(_ path: String) -> Bool {
 }
 
 func isExecutable(_ path: String) -> Bool {
-    FileManager.default.isExecutableFile(atPath: path)
+    let fm = FileManager.default
+    var isDir: ObjCBool = false
+    let exists = fm.fileExists(atPath: path, isDirectory: &isDir)
+    return fm.isExecutableFile(atPath: path) && !isDir.boolValue && exists
 }
 
 func codesign(identity: String, path: String, options: String = defaultCodesignOptions) throws {