Skip to content

Commit

Permalink
STL: Allow uninstalling partially installed STL
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidoTek committed Sep 14, 2022
1 parent 4ca820b commit 3472e3a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pupgui2/steamutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ def remove_steamtinkerlaunch(compat_folder='', remove_config=True) -> bool:
if os.path.exists(compat_folder):
print('Removing SteamTinkerLaunch compatibility tool...')
shutil.rmtree(compat_folder)
subprocess.run(['steamtinkerlaunch', 'compat', 'del'])
if shutil.which('steamtinkerlaunch'):
subprocess.run(['steamtinkerlaunch', 'compat', 'del'])

if os.path.exists(STEAM_STL_INSTALL_PATH):
print('Removing SteamTinkerLaunch installation...')
Expand All @@ -343,6 +344,8 @@ def remove_steamtinkerlaunch(compat_folder='', remove_config=True) -> bool:
for shell_file in present_shell_files:
with open(shell_file, 'r+') as mfile:
mfile_lines = list(filter(lambda l: 'protonup-qt' not in l.lower() and STEAM_STL_INSTALL_PATH.lower() not in l.lower(), [line for line in mfile.readlines()]))
if len(mfile_lines) == 0:
continue
mfile_lines = mfile_lines[:-1] if len(mfile_lines[-1].strip()) == 0 else mfile_lines

# Preserve any existing Fish user paths
Expand All @@ -362,6 +365,6 @@ def remove_steamtinkerlaunch(compat_folder='', remove_config=True) -> bool:

print('Successfully uninstalled SteamTinkerLaunch!')
return True
except IOError:
print('Something went wrong trying to uninstall SteamTinkerLaunch. Aborting...')
except IOError as e:
print('Something went wrong trying to uninstall SteamTinkerLaunch. Aborting...', e)
return False

0 comments on commit 3472e3a

Please sign in to comment.