From f3e4fe984602db1dbf0fd6ce6375a5e2ad403b77 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Thu, 5 Dec 2024 15:49:38 +0800 Subject: [PATCH] mac-crafter: Check if path to trecursively codesign exists and throw error if it doesn't Signed-off-by: Claudio Cambra --- admin/osx/mac-crafter/Sources/Utils/Codesign.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/admin/osx/mac-crafter/Sources/Utils/Codesign.swift b/admin/osx/mac-crafter/Sources/Utils/Codesign.swift index be7eb586d..4b2341274 100644 --- a/admin/osx/mac-crafter/Sources/Utils/Codesign.swift +++ b/admin/osx/mac-crafter/Sources/Utils/Codesign.swift @@ -21,6 +21,7 @@ enum CodeSigningError: Error { } enum AppBundleSigningError: Error { + case doesNotExist(String) case couldNotEnumerate(String) } @@ -64,6 +65,10 @@ func recursivelyCodesign( skip: [String] = [] ) throws { let fm = FileManager.default + guard fm.fileExists(atPath: path) else { + throw AppBundleSigningError.doesNotExist("Item at \(path) does not exist.") + } + guard let pathEnumerator = fm.enumerator(atPath: path) else { throw AppBundleSigningError.couldNotEnumerate( "Failed to enumerate directory at \(path)." -- 2.30.2