diff --git a/ReleaseTooling/Sources/Utils/FileManager+Utils.swift b/ReleaseTooling/Sources/Utils/FileManager+Utils.swift index 14af5f0406a..1a657fd5155 100644 --- a/ReleaseTooling/Sources/Utils/FileManager+Utils.swift +++ b/ReleaseTooling/Sources/Utils/FileManager+Utils.swift @@ -28,6 +28,9 @@ public extension FileManager { /// All folders with a `.bundle` extension. case bundles + /// All folders with a `.bundle` extension excluding privacy manifest bundles. + case nonPrivacyBundles + /// A directory with an optional name. If name is `nil`, all directories will be matched. case directories(name: String?) @@ -186,6 +189,13 @@ public extension FileManager { if fileURL.pathExtension == "bundle" { matches.append(fileURL) } + case .nonPrivacyBundles: + // The only thing of interest is the path extension being ".bundle", but not a privacy + // bundle. + if fileURL.pathExtension == "bundle", + !fileURL.lastPathComponent.hasSuffix("_Privacy.bundle") { + matches.append(fileURL) + } case .headers: if fileURL.pathExtension == "h" { matches.append(fileURL) diff --git a/ReleaseTooling/Sources/ZipBuilder/ResourcesManager.swift b/ReleaseTooling/Sources/ZipBuilder/ResourcesManager.swift index fd2a6ad6a00..48d1a964db8 100644 --- a/ReleaseTooling/Sources/ZipBuilder/ResourcesManager.swift +++ b/ReleaseTooling/Sources/ZipBuilder/ResourcesManager.swift @@ -30,7 +30,7 @@ extension ResourcesManager { static func directoryContainsResources(_ dir: URL) throws -> Bool { // First search for any .bundle files. let fileManager = FileManager.default - let bundles = try fileManager.recursivelySearch(for: .bundles, in: dir) + let bundles = try fileManager.recursivelySearch(for: .nonPrivacyBundles, in: dir) // Stop searching if there were any bundles found. if !bundles.isEmpty { return true } @@ -168,7 +168,7 @@ extension ResourcesManager { to resourceDir: URL, keepOriginal: Bool = false) throws -> [URL] { let fileManager = FileManager.default - let allBundles = try fileManager.recursivelySearch(for: .bundles, in: dir) + let allBundles = try fileManager.recursivelySearch(for: .nonPrivacyBundles, in: dir) // If no bundles are found, return an empty array since nothing was done (but there wasn't an // error).