Custom Command: Launch .lnk files using Proton automatiically #1107
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.
When trying to use
.lnk
files as custom commands, SteamTinkerLaunch will default to interpreting these as native games, because it does not return thePE32
string from "Files" and it is not a.bat
script. Since this is not a native program it will try to run this with whatever program is set up on the system to handle files of this type. Commonly this is Wine but if a user doesn't have Wine installed it could end up opening a text editor, a hex editor, or anything really.As a workaround it is possible to force Proton since 77e0772 (no PR for this one apparently). But this is not ideal.
To fix this, we check if the custom command ends with
.lnk
and if so we catch this as a custom command to run with Proton. I tested this with Touhou 16 and it fixed the problem. Without this PR it tries to use the system Wine to run the file.We could've used
file
here to check forMS Windows shortcut
but I opted to check the extension for simplicity and just in case this ever returns a different string (PE32
is universal and virtually guaranteed to never change). This isn't perfect because if a filename has.lnk
anywhere we'll try to use Proton even if it's not a Windows shortcut. But we do the exact same check for.bat
files and it could have the exact same pitfalls, but that has not yet been reported.If either of these ever become issues though we can use a different pattern to match the end of the string with the extension.
NOTE: Custom commands do not use the Steam Linux Runtime, but maybe this will change in the near future, as I've run into a few cases recently where I want to use custom commands to replace a game launch, and the lack of SLR has caused issues.
TOD: