Closed sonic2kk closed 9 months ago
This PR adds many, many functions for interfacing with the shortcuts.vdf
file, including fetching and editing specific entries. These functions will be generally useful and will also allow for, in this PR, updating the icon for Non-Steam Games.
The next step for this PR is to fetch the icon for Non-Steam Games.
Oh yeah, we'll also need to run shellcheck and do some fixups. I haven't checked yet but I suspect it'll be a real mess...
Untested implementation for setting the shortcut icon. There are now three mostly untested changes:
getSteamGridDBNonSteamIcon
was broken out into a separate function. This works with getGridsForNonSteamGames
but I didn't test if it works for addNonSteamGame
yet. This needs testedgetSteamGridDBNonSteamIcon
now returns the icon path, which we didn't check for before. We need to make sure that this icon path is valid at least for addNonSteamGame
, and that it works as expected.editSteamShortcutEntry
was tested during debugging and updated a hardcoded icon path for a given shortcut, but has not been tested in getSteamGridDBNonSteamIcon
yet.I also did a quick run of ShellCheck. No glaring errors, just a couple of style, globbing, and unused/unnecessary variable changes that need addressed. Once the above testing is done and this is all working, it should be straightforward to address those and get this merged.
We're almost there!
Can't set the icon in getSteamGridDBNonSteamIcon
in its current form just yet, because it sets the icon to all the downloading output. Damn! We'll figure out a way though, probably tomorrow.
It is updating the shortcuts.vdf
file though, so it will work once we correctly pass it the path for the icon.
We should also add some more logging before merging this PR.
Got some rough changes locally that I'll push soon which resolve the remaining functionality issues, and allow icons to be downloaded and set when updating grids for Non-Steam Games! We correctly edit shortcuts.vdf
and insert the value.
Some more testing needs to be done, and there is some potential to break out a couple of areas into separate functions, bbut functionally the PR is complete once I push my local changes. Major progress, really just testing and cleanup remains!
Tested adding Non-Steam Games, setting the icon appears to still work.
Shellcheck fiixes in place, this is probably ready for merging after a couple more tests...
Add Non-Steam Game still works, getid/title still works, editing shortcut fields works, I think this is ready to merge! Testing and shellcheck are green and version is bumped. No langfile changes here.
The way we handle which column to edit in editSteamShortcutEntry
is perhaps a little inefficient in that it uses a case statement, but eh, I think it's fine. It's for internal use only anyway, in future if there's demand it would be easy to expose on the commandline though.
I never did update the PR description but I think it's fine.
Heavily WIP, currently does the following:
shortcuts.vdf
getIDFromTitle
getTitleFromID
steamtinkerlaunch update grid nonsteam
(alternatively,update grid shortcut
)Remaining work before I edit this PR description with something more informative and structured: