Skip to content

Commit

Permalink
settings(apple): restrict virtiofs sharing to macOS 12
Browse files Browse the repository at this point in the history
Resolves utmapp#3496
  • Loading branch information
osy committed Jan 17, 2022
1 parent bde8871 commit 70d5907
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
12 changes: 12 additions & 0 deletions Platform/Shared/VMWizardState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,21 @@ class VMWizardState: ObservableObject {
#endif
if operatingSystem == .Linux && linuxRootImageURL != nil {
nextPage = .sharing
if useAppleVirtualization {
if #available(macOS 12, *) {
} else {
nextPage = .summary
}
}
}
case .drives:
nextPage = .sharing
if useAppleVirtualization {
if #available(macOS 12, *) {
} else {
nextPage = .summary
}
}
case .sharing:
nextPage = .summary
case .summary:
Expand Down
8 changes: 6 additions & 2 deletions Platform/macOS/Display/VMDisplayAppleWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@ class VMDisplayAppleWindowController: VMDisplayWindowController {
drivesToolbarItem.isEnabled = false
usbToolbarItem.isEnabled = false
startPauseToolbarItem.isEnabled = true
sharedFolderToolbarItem.isEnabled = appleConfig.bootLoader?.operatingSystem == .Linux
if #available(macOS 12, *) {
isPowerForce = false
sharedFolderToolbarItem.isEnabled = appleConfig.bootLoader?.operatingSystem == .Linux
} else {
// stop() not available on macOS 11 for some reason
restartToolbarItem.isEnabled = false
sharedFolderToolbarItem.isEnabled = false
isPowerForce = true
}
}
Expand Down Expand Up @@ -165,6 +166,9 @@ class VMDisplayAppleWindowController: VMDisplayWindowController {
}

@IBAction override func sharedFolderButtonPressed(_ sender: Any) {
guard #available(macOS 12, *) else {
return
}
if !isSharePathAlertShownOnce && !isSharePathAlertShownPersistent {
let alert = NSAlert()
alert.messageText = NSLocalizedString("Directory sharing", comment: "VMDisplayAppleWindowController")
Expand All @@ -182,7 +186,7 @@ class VMDisplayAppleWindowController: VMDisplayWindowController {
}
}

@available(macOS 11, *)
@available(macOS 12, *)
extension VMDisplayAppleWindowController {
func openShareMenu(_ sender: Any) {
let menu = NSMenu()
Expand Down
10 changes: 6 additions & 4 deletions Platform/macOS/VMAppleRemovableDrivesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ struct VMAppleRemovableDrivesView: View {
}
HStack {
Spacer()
Button("New Shared Directory...") {
selectType = .sharedDirectory
selectedSharedDirectoryBinding = nil
showFileImporter()
if #available(macOS 12, *) {
Button("New Shared Directory...") {
selectType = .sharedDirectory
selectedSharedDirectoryBinding = nil
showFileImporter()
}
}
Button("New External Drive...") {
selectType = .diskImage
Expand Down

0 comments on commit 70d5907

Please sign in to comment.