viper icon indicating copy to clipboard operation
viper copied to clipboard

fix: Do not overwrite modified config files without warning

Open GeckoEidechse opened this issue 3 years ago • 4 comments

Config files commonly modified by players, like R2Northstar\mods\Northstar.CustomServers\mod\cfg\autoexec_ns_server.cfg should not be overwritten without warning if their content has been changed.

To check if their content has changed, compare the content with that of the unmodified version of the file of the current install.

It's probably enough to have a few "whitelisted" files to perform this check on. Doing it over all files is likely not necessary.

GeckoEidechse avatar Jan 15 '22 12:01 GeckoEidechse

There is an excludes array in your viper.json which you could add it to. I'll just add these files to the defaults, which would implement it.

I was mostly unaware mods had a cfg folder in them, seems kind of dumb to not just have them in a mods/cfg or R2Northstar/cfg folder.

0neGal avatar Jan 15 '22 14:01 0neGal

@GeckoEidechse is there a standard way to store mods configuration files? Like are they all in mods/My.Mod/cfg/ folder, or all named *.cfg (mods/My.Mod/**/*.cfg)?

This would allow us to do some pattern matching to exclude them from being overwritten.

Alystrasz avatar Feb 19 '22 22:02 Alystrasz

Like are they all in mods/My.Mod/cfg/ folder, or all named *.cfg (mods/My.Mod/**/*.cfg)?

To my knowledge everything is in <mod>/cfg, but the actual file names can be anything from .json to .nut, however I've seen a few which put the settings inside <mod>/mod.json which seems like something we shouldn't try to merge.

0neGal avatar Feb 19 '22 22:02 0neGal

Basically what 0neGal said. (I'm actually not too familiar with the mod structure myself.)

Note that there could also be a case where a mod updates its configuration files to add/remove parameters. I'm not sure how Viper would best handle such a situation tbh.

GeckoEidechse avatar Feb 20 '22 10:02 GeckoEidechse

Unsure if this is much of a problem anymore, I don't know how ModSettings actually stores settings, but assuming that most mods by now use it, and it happens to store it somewhere outside of it's package folder (somehow?), then this would be fixed? And most of it did get merged into NS' core mods right?

0neGal avatar Jul 31 '23 13:07 0neGal

Not really and honestly, since then things kinda changed and everything in Northstar.XXXXX should be overwritten on update.

The config is unfortunately still not set up to be modified from somewhere separate but I'd consider that an upstream bug and not something that Viper should attempt to solve.

GeckoEidechse avatar Jul 31 '23 13:07 GeckoEidechse