jtsage / FS_Mod_Checker

Check your Farming Simulator 2019 or 2022 mod folder for bad files and unused mods.
ISC License
20 stars 3 forks source link

[FEATURE] Actionable items? #18

Closed kbrandwijk closed 3 months ago

kbrandwijk commented 3 years ago

Do you have any plans to add actionable items to the passive checker?

jtsage commented 3 years ago

I'm really on the fence about this. So, a couple of thoughts.

1.) Move inactive, unused to a different "I-want-to-delete-these-mods" folder.

That's pretty easy. Current version has the full path of the mod, it would just be generating a folder name, probably with a date string included. I need to look at how annoying I can make the "Are you really sure" on this, and I think atomic operation is going to be the safest way forward - no "move all these".

1a.) Move broken to somewhere else

For a subset of broken. Probably just the "this is an identical copy", "this is a nonsense file". Everything else I'm really just taking a guess at - it's an educated guess, but I could still be wrong.

2.) Remove from savegame if active & unused.

This is possible. It's just removing a line from careerSavegame.xml. The question is how/when to back up the file first, should something go wrong. Again, atomic operation, no batch.

3.) Similar, remove missing mod - but...

I can do it if it's unused. Trying to edit either vehicles.xml or items.xml is not a road I'm willing to travel. I'd have no issue doing it by hand, but this only really seems feasible if I were to load the xml tree as a tree, and the library I used preserved everything (it does not. for speed it drops comments, and it does some case mangling - which is fine for pulling the data, but I'm not left with an object I could convert back to xml

4.) Download missing

I can search the web for them, but I'm not sure how to ask the modhub about them short of google with a site:... modifier. You mentioned the updater idea in #16 - which would be real cool, but is there a public API of the modhub? On a related note, how is the hash computed? It's not MD5 like I assumed.

jtsage commented 3 years ago

Implemented 1 and 1a.

Still hesitating on 2 & 3 - the only "safe" way to do it is atomically, and editing the careerSavegame.xml line-by-line (the node xml parser is nice, but not nice enough to assume that writing out a parsed tree is going to be the exact format FS is expecting - it likes to collapse case - which is great for reading and finding things, but I'm assuming the giants engine cares.) And line-by-line editing doesn't really seem "safe" to me. The additional problem I have is how to manage a sane backup. For the first operation, dropping .xml, adding .bak makes sense. But what about the second operation. Or the operation the next time the program is run. I could do [date string].bak, but if the user does more than 1 or 2 entries, that's going to get excessive fast.

4 is partially implemented in the right click menu on missing mods - you can search directly on the modhub, or on google (appending "FS19" to the title of the mod, usually about as good as it gets)