Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

add fallback for config failure #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

art0007i
Copy link
Member

@art0007i art0007i commented Jul 1, 2023

idk if this is a good idea but I hate it when my mods don't load because the config files saved incorrectly

(maybe I should stop spamming alt+f4 to quit the game which crashes it during the exit procedure, so that the config files don't corrupt in the first place)

Copy link
Collaborator

@zkxs zkxs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't actually solve the problem which is causing configs to get corrupted. More details on that in #97.

The effect of this PR would be that if the top-level map fails to deserialize we'd back up the corrupted config and make a fresh one... that's probably fine, and I think it's a good thing to do versus forcing the user to go hunt around their filesystem to manually delete the corrupted file. So you've got my approval.

@XDelta
Copy link
Member

XDelta commented Jul 6, 2023

I believe that File.Move will throw an exception if the destination path already has a file. IE if consecutive config fails occur or the old failed config wasn't removed after fixing the issue.

@XDelta
Copy link
Member

XDelta commented Jul 6, 2023

Either add an overwriting bit or write a unique filename to avoid. Don't have an overwrite option on File.Move until like .Net Core 3.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants