sonic2kk / steamtinkerlaunch

Linux wrapper tool for use with the Steam client for custom launch options and 3rd party programs
GNU General Public License v3.0
2.1k stars 70 forks source link

Commandline: Add support for Non-Steam Games to getGameDir #971

Closed sonic2kk closed 9 months ago

sonic2kk commented 9 months ago

Yet another bit of work for #960.

This PR adds support for getting a Non-Steam Game's game folder. We do this by parsing the Exe out of the shortcuts.vdf file and using the dirname of this as the EXE name. It was a little tricky integrating this into the existing getGameDir function, but I did it pretty cleanly, ignoring certain values or returning early if we still have to search on Non-Steam Games.

Initially in #960 I thought about parsing out the StartDir, but I think using the Exe base dir makes more sense. They're usually the same, and if they aren't, the user modified that and can check it from Steam. I don't see a case where a user would need to know the StartDir though, but I can imagine cases where they want to know where their Non-Steam Game was installed quickly from a command.

This function is also compatible with the only option that can be passed to this function.

In testing this works, but we need to make extra sure this doesn't break anything. After that though, a shellcheck and version bump will make this ready for merging.


This PR should complete the function integration work for Non-Steam Games, meaning the remaining work for #970 involves modifying localconfig.vdf using the functions added in #967, and the integration into the list command.

These functions were integrated first because list may make use of these, so I wanted to integrate them first. They're also just useful to have integrated!