diff options
Diffstat (limited to 'fungus/proton_manager.py')
| -rw-r--r-- | fungus/proton_manager.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/fungus/proton_manager.py b/fungus/proton_manager.py index e726cfc..23f0c86 100644 --- a/fungus/proton_manager.py +++ b/fungus/proton_manager.py @@ -419,9 +419,10 @@ def download_and_extract( button_update_callback("Extracting...") while pending_callback and pending_callback(): - pass + 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() |
