Skip to content

armgit / xtool

Public Imported from GitHub
0

Cross-platform Xcode replacement. Build and deploy iOS apps with SwiftPM on Linux, Windows, macOS.

Support unxipping Xcode betas (#115)

Kabir Oberaibf057263cc84
diff --git a/Sources/XToolSupport/SDKBuilder.swift b/Sources/XToolSupport/SDKBuilder.swift
index 40b2dd3..f78cfd2 100644
--- a/Sources/XToolSupport/SDKBuilder.swift
+++ b/Sources/XToolSupport/SDKBuilder.swift
@@ -238,7 +238,19 @@ struct SDKBuilder {
try await extractXIP(inputPath: inputPath, outDir: devStage.path)
}.value
try Task.checkCancellation()
- appDir = devStage.appendingPathComponent("Xcode.app")
+ let contents = try FileManager.default.contentsOfDirectory(
+ at: devStage,
+ includingPropertiesForKeys: nil
+ )
+ let apps = contents.filter { $0.pathExtension == "app" }
+ switch apps.count {
+ case 0:
+ throw Console.Error("Unrecognized xip layout (Xcode.app not found)")
+ case 1:
+ appDir = apps[0]
+ default:
+ throw Console.Error("Unrecognized xip layout (multiple apps found)")
+ }
cleanupStageDir = devStage
case .app(let appPath):
wanted = nil