Parcourir la source

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

osy il y a 2 ans
Parent
commit
3fe94bfb45
1 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 4 1
      Configuration/UTMQemuConfigurationQEMU.swift

+ 4 - 1
Configuration/UTMQemuConfigurationQEMU.swift

@@ -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)