Kesomannen / gale

Lightweight Thunderstore client
GNU General Public License v3.0
25 stars 3 forks source link

Untagged variables in config files throw a parsing error in Edit mod config #5

Closed subenji closed 1 month ago

subenji commented 1 month ago

On importing my current modlist from r2modman, I discovered that the Edit Mod Config page flagged errors on several mods, even though I had not edited those files. These errors are not an invalid configuration, only that the variables in question are not tagged with the expected comments. I expected such a parsing error to be thrown when the config file was invalid in such a way that meant parsing couldn't continue, or that an error was made that the game would reject - such as an incorrect data type, invalid charater, (Unicode?) etc. r2modman does not reject these variables in the affected config files.

An example, from Lethal Company's "More Ship Upgrades" mod: image image

[Strong Legs]

...

## If true: upgrade will apply only to the client that purchased it. (Overriden by 'Convert all upgrades to be shared' option in Misc section)
# Setting type: Boolean
# Default value: true
Individual Purchase = true

Damage mitigation when falling = 0.5

[Walkie GPS]
...

As r2modman behaved here, I expected such variables to be provided 'naked' with an undefined type or String type assumption. This bahaviour is also seen with EmployeeAssignments, Remnants, and especially LethalLevelLoader - the vast majority of its' auto-generated config is untagged.

Also as a nice to have, While there is a handy option to open the config file directly for parsed files, this is not available for config files that failed to parse - and they therefore need manual editing! Having that option, as well as an option to open up the config directory directly in the system file manager would be handy additions.

Also a minor note that I'm sure is just due to the project being so new - the right-click menu has various irrelevant/broken options: Print, Share, Save As (which is trying to save the html page) - and on the root sidebar buttons: Open link in new window, Save link as, Copy link. I discovered those when trying to open the file/directory as mentioned above.

Kesomannen commented 1 month ago

I'm almost done with this, along with other improvements to the config editor (like the edit and delete button for failed files).

I expected such a parsing error to be thrown when the config file was invalid in such a way that meant parsing couldn't continue, or that an error was made that the game would reject - such as an incorrect data type, invalid charater, (Unicode?) etc. r2modman does not reject these variables in the affected config files.

The reason it can't just skip invalid entries is because it has to re-serialize the whole file when you edit an entry. This would cause faulty entries to just disappear, which didn't seem like the best approach.

Also a minor note that I'm sure is just due to the project being so new - the right-click menu has various irrelevant/broken options: Print, Share, Save As (which is trying to save the html page) - and on the root sidebar buttons: Open link in new window, Save link as, Copy link. I discovered those when trying to open the file/directory as mentioned above.

This is from the underlying web view (basically the browser on which the app runs). I just removed it in 0.3.0

Kesomannen commented 1 month ago

https://github.com/Kesomannen/gale/releases/tag/0.3.0