Skip to content

Commit

Permalink
wizard: fix IPSW selection not working
Browse files Browse the repository at this point in the history
  • Loading branch information
osy committed Aug 24, 2023
1 parent 332a662 commit 76ce306
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Platform/Shared/VMWizardOSMacView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ struct VMWizardOSMacView: View {
wizardState.busyWorkAsync {
#if arch(arm64)
let url = try result.get()
let scopedAccess = url.startAccessingSecurityScopedResource()
defer {
if scopedAccess {
url.stopAccessingSecurityScopedResource()
}
}
let image = try await VZMacOSRestoreImage.image(from: url)
guard let model = image.mostFeaturefulSupportedConfiguration?.hardwareModel else {
throw NSLocalizedString("Your machine does not support running this IPSW.", comment: "VMWizardOSMacView")
Expand Down
6 changes: 6 additions & 0 deletions Platform/macOS/VMConfigAppleBootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ struct VMConfigAppleBootView: View {
case .ipsw:
if #available(macOS 12, *) {
#if arch(arm64)
let scopedAccess = url.startAccessingSecurityScopedResource()
defer {
if scopedAccess {
url.stopAccessingSecurityScopedResource()
}
}
let image = try await VZMacOSRestoreImage.image(from: url)
guard let model = image.mostFeaturefulSupportedConfiguration?.hardwareModel else {
throw NSLocalizedString("Your machine does not support running this IPSW.", comment: "VMConfigAppleBootView")
Expand Down

0 comments on commit 76ce306

Please sign in to comment.