From da581e2b0e426830f7c0106dc1ee1b68cf5762ba Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Thu, 21 Nov 2024 16:24:52 +0800 Subject: [PATCH] Do not treat bundles as executables in codesign check Signed-off-by: Claudio Cambra --- admin/osx/mac-crafter/Sources/Utils/Codesign.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/admin/osx/mac-crafter/Sources/Utils/Codesign.swift b/admin/osx/mac-crafter/Sources/Utils/Codesign.swift index a2b961eb87e3d..139a1e802449c 100644 --- a/admin/osx/mac-crafter/Sources/Utils/Codesign.swift +++ b/admin/osx/mac-crafter/Sources/Utils/Codesign.swift @@ -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 {