config(qemu): do not delete TPM data when option is disabled

This commit is contained in:
osy 2023-07-14 13:53:38 -07:00
parent 7e88e994d1
commit 3fe94bfb45
1 changed files with 4 additions and 1 deletions

View File

@ -182,9 +182,12 @@ extension UTMQemuConfigurationQEMU {
efiVarsURL = varsURL
existing.append(varsURL)
}
let possibleTpmDataURL = dataURL.appendingPathComponent(QEMUPackageFileName.tpmData.rawValue)
if hasTPMDevice {
tpmDataURL = dataURL.appendingPathComponent(QEMUPackageFileName.tpmData.rawValue)
tpmDataURL = possibleTpmDataURL
existing.append(tpmDataURL!)
} else if FileManager.default.fileExists(atPath: possibleTpmDataURL.path) {
existing.append(possibleTpmDataURL) // do not delete any existing TPM data
}
if hasDebugLog {
let debugLogURL = dataURL.appendingPathComponent(QEMUPackageFileName.debugLog.rawValue)