about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2026-07-05 10:15:18 +0300
committerAndrew Dolgov <fox@fakecake.org>2026-07-05 10:15:18 +0300
commita7d854250c12bc75eaebc3625a3e42c3047f8b60 (patch)
tree3518209e6ce8ad67d33f0d1869fbec1d3dacd87e
parentdad14d0b178e338a297b42fa39151d4871e5d18f (diff)
downloadfungus-launcher-a7d854250c12bc75eaebc3625a3e42c3047f8b60.tar.gz
fungus-launcher-a7d854250c12bc75eaebc3625a3e42c3047f8b60.tar.xz
deal with temp dir not being removed if proton tarball extraction fails
-rw-r--r--fungus/add_game_dialog.py4
-rw-r--r--fungus/proton_manager.py11
2 files changed, 11 insertions, 4 deletions
diff --git a/fungus/add_game_dialog.py b/fungus/add_game_dialog.py
index 65af71b..2db1d9c 100644
--- a/fungus/add_game_dialog.py
+++ b/fungus/add_game_dialog.py
@@ -404,10 +404,6 @@ class AddGame(EntryTooltipMixin, Gtk.Dialog):
         self.tab_box2.show_all()
         self.show_all()
 
-    def on_image_clicked(self, widget, event):
-        """Show the icon context menu on right-click."""
-        self.menu.popup_at_pointer(event)
-
     def populate_combobox_with_runners(self):
         """Fill the Proton runner combobox with available runners."""
         from fungus.utils import populate_combobox_with_runners as _pop
diff --git a/fungus/proton_manager.py b/fungus/proton_manager.py
index c8be518..23f0c86 100644
--- a/fungus/proton_manager.py
+++ b/fungus/proton_manager.py
@@ -422,6 +422,7 @@ def download_and_extract(
         time.sleep(0.01)
 
     mode = "r:xz" if tar_file_path.endswith(".tar.xz") else "r:gz"
+    temp_dir = None  # cleaned up on failure
 
     try:
         with tarfile.open(tar_file_path, mode) as tar:
@@ -472,6 +473,16 @@ def download_and_extract(
             message_callback("Error during extraction")
         if button_update_callback:
             button_update_callback("Download")
+        # Clean up temp files on failure
+        try:
+            os.remove(tar_file_path)
+        except OSError:
+            pass
+        if temp_dir:
+            try:
+                shutil.rmtree(temp_dir)
+            except OSError:
+                pass
     finally:
         if button_enable_callback:
             button_enable_callback()