Skip to content

Commit bf05726

Browse files
authored
Support unxipping Xcode betas (#115)
Xcode betas are stored in the xip as Xcode-beta.app. Support this by avoiding hardcoding the `Xcode.app` path.
1 parent 9e80b7d commit bf05726

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

Sources/XToolSupport/SDKBuilder.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,19 @@ struct SDKBuilder {
238238
try await extractXIP(inputPath: inputPath, outDir: devStage.path)
239239
}.value
240240
try Task.checkCancellation()
241-
appDir = devStage.appendingPathComponent("Xcode.app")
241+
let contents = try FileManager.default.contentsOfDirectory(
242+
at: devStage,
243+
includingPropertiesForKeys: nil
244+
)
245+
let apps = contents.filter { $0.pathExtension == "app" }
246+
switch apps.count {
247+
case 0:
248+
throw Console.Error("Unrecognized xip layout (Xcode.app not found)")
249+
case 1:
250+
appDir = apps[0]
251+
default:
252+
throw Console.Error("Unrecognized xip layout (multiple apps found)")
253+
}
242254
cleanupStageDir = devStage
243255
case .app(let appPath):
244256
wanted = nil

0 commit comments

Comments
 (0)