SteamGridDB / steam-rom-manager

The bulk game importer and artwork manager for Steam!
https://steamgriddb.github.io/steam-rom-manager/
GNU General Public License v3.0
1.91k stars 123 forks source link

[BUG] Manual parser finds no apps #723

Open schradert opened 1 week ago

schradert commented 1 week ago

I can't get my Manual type parser to find my programs. I just says no apps found. I am specifying a Manifests Directory which exists and only has JSON files in it, each of which contains the config for a single title with all the specified fields in the manual entry: title, target, startIn, launchOptions, and appendArgsToExecutable. Can I show more verbose logging somehow? Anybody experienced this?

  1. Populate empty directory with a chiaki.manifest.json file in it with the following contents:
{
  "title": "chiaki-ng",
  "target": "chiaki",
  "startIn": "./",
  "launchOptions": "",
  "appendArgsToExecutable": true
}
  1. Create a Manual parser in steam-rom-manager with the Manifests Directory set to the directory path above
  2. Test or run Add games

This should find the config file and add the program!

Upvote & Fund

Fund with Polar

schradert commented 4 days ago

Okay I figured out that it does work if the contents are structured as an array:

[
  {
    "title": "chiaki-ng",
    "target": "chiaki",
    "startIn": "./",
    "launchOptions": "",
    "appendArgsToExecutable": true
  }
]

So, the FAQ is not accurate.

schradert commented 4 days ago

Also it looks like it does matter that files have a .json extension.

schradert commented 4 days ago

So, the FAQ is not accurate.

Now that I've reviewed this closer, I understand what's happening. I wasn't careful enough with how I reported the bug. Technically the contents of my chiaki.manifest.json in the failing scenario was:

{
  "appendArgsToExecutable": true,
  "launchOptions": "",
  "startIn": "./",
  "target": "chiaki",
  "title": "chiaki-ng"
}

I am generating JSON dynamically and by default it orders keys alphabetically. This matters because the parser only checks the value type of the first key. The parser will work correctly as long as the first key is a string in the top-level object case, which I have now tested successfully.

Maybe I'm the only one ever who will encounter this error, but I guess you never know. I can easily see someone doing the same thing I did or even manually ordering the fields by preference. This situation can be easily avoided by just forcing jsonObj to be an array if it isn't, and the code would be less fragile and cleaner IMHO.