-
Notifications
You must be signed in to change notification settings - Fork 705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Core: save default settings before opening file for users #4042
Conversation
Shouldn't |
oh nice catch, I'd be happy if you had a solution to these worries 😅 but I don't so I'm personally content with some redundant saving on a user action |
The more I look at get_settings, the more I think that the fact that it can save is an undesirable side effect in most cases. This function does two things, it should only do one, accessing the current settings (not saving them). As you said, in most cases, callers are happy with just the values and don't need the actual file to be up-to-date. It's only in the case where we actually want to open or modify the settings that it needs to be saved. That being said, changing that seems like a medium size and maybe impacting refactor. I've checked only a handful of the calls and have no idea if it would impact something to move the save out of get_settings. All things considered, the unnecessary save seems pretty harmless. |
so is that an approval? 😅 |
I said something alone those lines in discord: get_settings() is not supposed to save. So, the solution presented in this PR is mostly correct - you only safe if the user explicitly asks to have the current file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
What is this fixing or adding?
saves the settings before opening host.yaml so all defaults are populated
How was this tested?
had an outdated host.yaml for TUNIC, installed the new one, clicked the open host.yaml button in the launcher, saw the new settings values populated
If this makes graphical changes, please attach screenshots.