Add conditional macOS beta support

This commit is contained in:
Nindi Gill 2023-06-09 23:17:40 +10:00
parent 4837dc37c7
commit bdf4fa1e34
No known key found for this signature in database
GPG key ID: FF9A7FD590D4F4B1

View file

@ -312,6 +312,19 @@ class TaskManager: ObservableObject {
tasks += [
MistTask(type: .create, description: "macOS Installer in Disk Image") {
try await InstallerCreator.create(installer, mountPoint: mountPointURL, cacheDirectory: cacheDirectory)
guard let major: Substring = installer.version.split(separator: ".").first else {
return
}
let source: URL = mountPointURL.appendingPathComponent("Applications/Install macOS \(major) beta.app")
let destination: URL = mountPointURL.appendingPathComponent("Applications/Install \(installer.name).app")
guard FileManager.default.fileExists(atPath: source.path) else {
return
}
try await FileMover.move(source, to: destination)
}
]
}