Add Non-Steam Game: Add feedback when exe is invalid #959
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.
Adds logging, notifier, and terminal output when the executable path for a Non-Steam Game is blank or invalid.
To do this we made a couple of changes:
sed
to remove double quotes from the beginning and end of the string. We do the-z
and-f
check on that. This is not strictly required for the-z
check, since we don't quote unless the incoming EXE is-n
, but we do need to do this to correctly check for a valid EXE path. Since we quote the string if it's defined. I chose to do this as a stylistic choice over having an-f
check in the case block.return 1
, which means they'll exit the function and it means we can remove the-n
check forNOSTEXEPATH
. This lets us have a cleaner and less indented function. It's been bugging me for a while and I finally got around to fixing it. We exit earlier instead of having all of our Add Non-Steam Game logic wrapped in anif
block, it reads nicer imo.When running
steamtinkerlaunch ansg
without--appname
, the GUI will always open, however the GUI can pass a blank EXE. So our presence check will fire there even if it doesn't fire on the commandline. The path check will work for both the GUI and commandline though.I tested this on the GUI and commandline, and the checks seem to fire correctly. The refactor to remove everything being wrapped in the
-n "$NOSTEXEPATH"
check also doesn't seem to have broken anything. Adding Non-Steam Games works as expected and I confirmed the function shops if the EXE is invalid or not set by checking both the logs and whethershortcuts.vdf
was modified. The SteamGridDB stuff all still works good.But a better, fuller test is probably a good idea.
TODO: