[gnome-boxes] vm-creator: Delete under-install/live VM on media deletion



commit 786f195d2627b3988c36b964411e8f4e66398c06
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Apr 10 00:57:07 2013 +0300

    vm-creator: Delete under-install/live VM on media deletion
    
    Before continuing installation/live session on a machine, we now check
    if the source installer media exists. If it doesn't, there is no point in
    keeping around a useless machine so we automatically delete it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686329

 src/vm-creator.vala |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index 287af92..99e6893 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -87,6 +87,14 @@ private class Boxes.VMCreator {
             return;
         }
 
+        if (!FileUtils.test (install_media.device_file, FileTest.EXISTS)) {
+            warning ("Source installer media '%s' no longer exists. Deleting machine '%s'..",
+                     install_media.device_file,
+                     machine.name);
+            App.app.delete_machine (machine);
+            return;
+        }
+
         install_media.prepare_to_continue_installation (name);
 
         state_changed_id = machine.notify["state"].connect (on_machine_state_changed);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]