Skip to content

Commit

Permalink
vm: fix error when trying to rename VM
Browse files Browse the repository at this point in the history
Fixes #5444
  • Loading branch information
osy committed Jul 10, 2023
1 parent 1edf8b1 commit 5d98afb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Services/UTMVirtualMachine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ extension UTMVirtualMachine {
let existingPath = pathUrl
let newPath = Self.virtualMachinePath(for: config.information.name, in: existingPath.deletingLastPathComponent())
try await config.save(to: existingPath)
try await updateRegistryFromConfig()
let hasRenamed: Bool
if !isShortcut && existingPath.path != newPath.path {
try await Task.detached {
Expand All @@ -359,10 +360,10 @@ extension UTMVirtualMachine {
} else {
hasRenamed = false
}
try await updateRegistryFromConfig()
// reload the config if we renamed in order to point all the URLs to the right path
if hasRenamed {
try reload(from: newPath)
try await updateRegistryBasics() // update bookmark
}
}
}
Expand Down

0 comments on commit 5d98afb

Please sign in to comment.