Skip to content

Commit

Permalink
settings: sync ejected drives and removed shared directories
Browse files Browse the repository at this point in the history
Fixes #5708
  • Loading branch information
osy committed Oct 3, 2023
1 parent a042b88 commit 4ad28af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Services/UTMAppleVirtualMachine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,8 @@ extension UTMAppleVirtualMachine {
if drive.isExternal, let url = drive.imageURL {
let file = try UTMRegistryEntry.File(url: url, isReadOnly: drive.isReadOnly)
registryEntry.externalDrives[drive.id] = file
} else if drive.isExternal {
registryEntry.externalDrives.removeValue(forKey: drive.id)
}
}
// remove any unreferenced drives
Expand Down
4 changes: 4 additions & 0 deletions Services/UTMQemuVirtualMachine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -828,10 +828,14 @@ extension UTMQemuVirtualMachine {
for drive in configDrives {
if drive.isExternal, let url = drive.imageURL {
try await changeMedium(drive, to: url)
} else if drive.isExternal {
try await eject(drive)
}
}
if let url = configShare {
try await changeSharedDirectory(to: url)
} else {
await clearSharedDirectory()
}
// remove any unreferenced drives
registryEntry.externalDrives = registryEntry.externalDrives.filter({ element in
Expand Down

0 comments on commit 4ad28af

Please sign in to comment.