Skip to content

Commit 7d42ee3

Browse files
authored
Update proton_manager.py
1 parent 2b4ba19 commit 7d42ee3

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

source-code/proton_manager.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ def install_proton(self, version, proton_type, progress_callback=None):
145145
print(f"No tar.gz asset found for {version}")
146146
return False, f"No tar.gz asset found for {version}"
147147
dl_url = tar_asset['browser_download_url']
148-
if progress_callback:
149-
progress_callback("Downloading", 0, 100)
148+
progress_callback("Downloading", 0, 100)
150149
with tempfile.NamedTemporaryFile(suffix='.tar.gz', delete=False) as temp_tar:
151150
response = requests.get(dl_url, stream=True, timeout=30)
152151
response.raise_for_status()
@@ -161,8 +160,7 @@ def install_proton(self, version, proton_type, progress_callback=None):
161160
if progress_callback and total_size:
162161
progress_callback("Downloading", downloaded, total_size)
163162
temp_tar_path = temp_tar.name
164-
if progress_callback:
165-
progress_callback("Extracting", 0, 100)
163+
progress_callback("Extracting", 0, 100)
166164
extract_dir = os.path.join(self.protons_dir, version)
167165
os.makedirs(extract_dir, exist_ok=True)
168166
with tarfile.open(temp_tar_path) as tar:
@@ -193,18 +191,13 @@ def install_proton(self, version, proton_type, progress_callback=None):
193191
except Exception as e:
194192
logging.error(f"Error installing {proton_type} proton {version}: {e}")
195193
print(f"Error installing {proton_type} proton {version}: {e}")
196-
if 'extract_dir' in locals():
197-
shutil.rmtree(extract_dir, ignore_errors=True)
198-
if 'temp_tar_path' in locals() and os.path.exists(temp_tar_path):
199-
os.remove(temp_tar_path)
200194
return False, str(e)
201195

202196
def install_custom_tar(self, tar_path, version, progress_callback=None):
203197
try:
204198
extract_dir = os.path.join(self.protons_dir, version)
205199
os.makedirs(extract_dir, exist_ok=True)
206-
if progress_callback:
207-
progress_callback("Extracting", 0, 100)
200+
progress_callback("Extracting", 0, 100)
208201
with tarfile.open(tar_path) as tar:
209202
for member in tar.getmembers():
210203
member_path = os.path.join(extract_dir, member.name)
@@ -232,8 +225,6 @@ def install_custom_tar(self, tar_path, version, progress_callback=None):
232225
except Exception as e:
233226
logging.error(f"Error installing custom tar: {e}")
234227
print(f"Error installing custom tar: {e}")
235-
if 'extract_dir' in locals():
236-
shutil.rmtree(extract_dir, ignore_errors=True)
237228
return False, str(e)
238229

239230
def install_custom_folder(self, src_folder, version):
@@ -248,8 +239,6 @@ def install_custom_folder(self, src_folder, version):
248239
except Exception as e:
249240
logging.error(f"Error installing custom folder: {e}")
250241
print(f"Error installing custom folder: {e}")
251-
if 'dest' in locals():
252-
shutil.rmtree(dest, ignore_errors=True)
253242
return False, str(e)
254243

255244
def remove_proton(self, version):

0 commit comments

Comments
 (0)