Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
misc: Fix commands being interpreted as game launch if command includ…
…ed `steamapps/common` (#1125) Noticed this when I tried to run a custom command for an executable in a game folder and it kept trying to launch the game, and realised we default to a game launch if the command contains `steamapps/common` in its string, even if it's part of an argument. Fixes cases where `otr --exe="/home/gaben/.local/share/Steam/steamapps/common/hl3.exe"` would be interpreted as a game launch because the One-Time Run executable path contained `steamapps/common`. This allows One-Time Run to work with executables in the game's install folder. We fix this by introducing a check to the first argument to a script. If the FIRST argument ONLY does not contain any forward-slashes AND if it matches a preset list of keywords, we assume it is a commandline argument and send it straight to the `commandline` function. So with `steamtinkerlaunch otr --exepath="/home/gaben/.local/share/Steam/steamapps/common/hl3.exe"`, we can detect that it is the One-Time Run command because the first command is `otr`. However, `/home/otrlol/.local/share/Steam` would be ignored, so if the first argument is a path to the Steam Linux Runtime or something coming from Steam, we ignore it because `otr` needs to be a whole word. Similarly, even `/home/otr` would be ignored, because this check explicitly ignores the first argument if it contains any slashes at all (SteamTinkerLaunch command names never start with a slash, you can ever have `otr` but you could have `otr --exe="/home/blah/blah"`, but `--exe` is the 2nd argument (`$2`) and we only check the 1st (`$1`).
- Loading branch information