From bdf4fa1e341120a8904b2d8a55af7ea4bc7be225 Mon Sep 17 00:00:00 2001 From: Nindi Gill Date: Fri, 9 Jun 2023 23:17:40 +1000 Subject: [PATCH] Add conditional macOS beta support --- Mist/Helpers/TaskManager.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Mist/Helpers/TaskManager.swift b/Mist/Helpers/TaskManager.swift index 062f548..3e914a5 100644 --- a/Mist/Helpers/TaskManager.swift +++ b/Mist/Helpers/TaskManager.swift @@ -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) } ] }