StardewModders / mod-ideas

Submit ideas for mods to create, or find your next mod project!
93 stars 5 forks source link

Mod to Backup All Configs for Other Mods #1208

Open SoraHjort opened 6 months ago

SoraHjort commented 6 months ago

So one of the biggest issues with dealing with Vortex Mod Manager is that it has absolutely no problem with wiping a mod's config file on an mod update. Which causes a lot of problems depending on the mod. Like with Happy Birthday it will wipe your birthdate. It's one of the reason why people tend to recommend manually installing mods instead of relying on any mod manager, vortex or otherwise.

So how about a mod that goes through all the mod folders and backups each one's config files (read: non asset folder or dll file) and stores it as a zip at start up? Maybe an option, if using the generic mod config mod, to restore an older backup. Of course, that's assuming that the API even lets mods read other mod's files, which if they can't then guess this suggestion is dead on arrival.

Honestly, this wouldn't even be needed if mods were able to store configs outside of their mod folders. Like in a separate ModConfig folder that vortex can't access. But if I'm understanding things right, that's not something SMAPI allows?

Which, hey, any SMAPI devs out there that see this, maybe look into that for an update so we wouldn't need a mod for it? I'd suggest that idea as well to you guys directly but you don't have a spot to make suggestions from what I'm seeing.

But yeah, a mod to just backup config files for all other mods would be nice, especially if they can be stored in a spot where vortex won't look or wipe. Plus it could be useful in the event you made a change and needed to revert due to an issue that cropped up.

Entoarox commented 6 months ago

The placement of config files is a explicit choice, it is possible for mods to place their config files elsewhere if they want to. It is just that the default config file will always be a config.json file in the folder for each mod.

If a mod comes with a config file in the download, then this is a mistake on the author's part and should be reported to them. It is a SMAPI policy that mods never include config files in their downloads, as SMAPI will generate config files automatically upon startup if they are missing.

SoraHjort commented 6 months ago

The placement of config files is a explicit choice

I've not encountered a current mod that doesn't store config information outside of their mod folder. Investments used to store the per-farm data outside, in a folder within the game's main directory, but they've since moved that into the mod's folder for some reason. (Unless it's a situation where I copied it for a backup, and I don't remember doing it, folder is dated 2021)

So if it is actually possible, it seems odd that not a single one does it. And if it's a case that mod makers don't know about it, maybe a campaign needs to be started to get them informed on it and maybe implement it.

But considering that one mod used to and no longer does, makes it feel from a player perspective like it's a feature in SMAPI that is no longer available.

If a mod comes with a config file in the download

I've not encountered a mod that does it. The reason why I'm looking for a mod solution for this is because vortex will delete the config.json file when a mod updates. Infact it wipes the whole directory when installing an update. So any generated file any mod makes gets deleted, and thus you have to recreate it. Or make a manual backup to restore files later.

Anyway, thanks for replying, was starting to think this was getting missed.

Entoarox commented 6 months ago

It is discouraged by SMAPI principles to place files outside the mods own directory, so it is not made easy to do so, unlike placing files in that directory, which SMAPI intentionally makes very easy to do.

As for Vortex, this is functionally a bug in Vortex then, and you should report it in the relevant space. Vortex should not be deleting any files it was not responsible for creating, unless you the user explicitly tell it to, because that goes against how SDV mods are implemented.

If Vortex wont get this fixed, I will see about pulling up pathos and seeing if things cant be done on the SMAPI side of things to work around it. So if your bug report to Vortex goes ignored or ends up denied, do come back and let us know!

(As for it getting missed, most modders are rather busy with a ton of projects already, so this place tends to be visited rarely)

SoraHjort commented 6 months ago

About half a week after I made the backup mod request I did put in a issue report for Vortex's github, because I do agree that Vortex, regardless of the game, should not be deleting everything even if it is in the mod's folder. Like maybe it should be cross referencing the old archives to figure out what files are procedurally generated and ignoring them instead of nuking the folder.

https://github.com/Nexus-Mods/Vortex/issues/15419

so far, no comment or tagging activity on it but it has only been five days so far. So we're in the "Wait and see" phase.

Though honestly, it feels like it would be better handled on SMAPI's end, instead of hoping and relying on any mod manager to not mess with things. Such as if configs were stored in their own "ModConfig" folder or something along those lines. But regardless if that isn't what the SMAPI devs want then that's fine. I'm just looking for a solution, one way or another, so that players have one less issue to deal with.

ASLaneZero commented 6 months ago

To add to the conversation, Mod Organiser 2 puts config files that are generated post-launch into the override folder, such that they are not lost when/if the mod is updated or uninstalled. This is a mixed bag, as we don't lose configs between updates, but because of the virtual folder setup, SMAPI will throw out a non-serious error that there are folders with files, but that none of them are content.json.

This is my go-to as far as "backups" are concerned.

sarahvloos commented 5 months ago

robocopy . "../ConfigBackup" /S config.* Create a .bat file with this as the content, place it in your mods folder (if you place it in a subfolder, it'll only backup configs from that subfolder), run it, go one folder up and you'll have a ConfigBackup folder with all config files unless someone decided to name their config file something else. This will also backup config.toml etc. Since it preserves folder structure, if you haven't uninstalled any mods, just copy the contents of ConfigBackup and paste it back on your mods folder, it'll overwrite any config files and only those files. If you did uninstall mods, delete their folders from ConfigBackup or wait until SMAPI gives you an error telling you the name of the folder you forgot to delete. image