misc: Remove VERSION.txt
and other text files from compatibility tool folder
#1151
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR updates the logic when running
steamtinkerlaunch compat del
to also remove files ending with.txt
when removing all files in the compatibility tool folder. This fixes thecompat del
command failing to remove the SteamTinkerLaunch folder in theSROOT/compatibilitytools.d/SteamTinkerLaunch
because it does not account for removing theVERSION.txt
file that may be generated by ProtonUp-Qt.There are also a couple of style changes to remove some indentation.
Background
When installing SteamTinkerLaunch with ProtonUp-Qt, ProtonUp-Qt will create a
VERSION.txt
file. It does this for various compatibility tools so that it can display the version on its UI (i.e. for SteamTinkerLaunch it might displayv14.0.20240728-1
, but Luxtorpeda it might display v70). ProtonUp-Qt creates this file in the directory of the compatibility tool, e.g.~/.local/share/Steam/compatibilitytools.d/SteamTinkerLaunch
. The logic to add theVERSION.txt
was added by me in DavidoTek/ProtonUp-Qt#174.However this logic presents a problem. If a user installs SteamTinkerLaunch with ProtonUp-Qt, but then tries to remove the compatibility tool symlink themselves with
steamtinkerlaunch compat del
, this will fail because SteamTinkerLaunch is very careful about what files it removes, limiting only to the script file itself and files ending with.vdf
(such ascompatibiltiytool.vdf
manifest file created for and required by the Steam Client for all compatibility tools). Once it removes these files it then tries to remove its compatibility tool install folder, but it cannot do this if there are files still in the folder, which would be the case as SteamTinkerLaunch does not remove theVERSION.txt
file created by ProtonUp-Qt.Solution
To fix this, we now remove the
VERSION.txt
file created by ProtonUp-Qt by adding an additional check to remove files ending with.txt
to thefind
command. Alternatively we could have used something likerm -rf
but the existing check is careful, and I wanted to preserve this (and it makes sense to be careful inside of the Steam folder).