-
Notifications
You must be signed in to change notification settings - Fork 34
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
Add a method of saving settings back to a file #1349
Comments
Thanks for creating the issue! One other alternative would be to have some sort of SaveSettingsEvent which the settings plugin detects. This way you could keep the Settings class clean |
Yes, sounds like #456 right? |
Yeah you can couple it with that one, but I don't know if it's a good idea to always save the settings when they are changed 🤔 I guess that behavior should be configurable with its own setting 👀 |
Since mValues is private it is just be easier to do the serializing as a Settings class method but a question remains: If there is a field, e.g - What should the settings.json look like? {
"assets.path": "/assets/"
} {
"assets": {
"path": "/assets/"
}
} I'm leaning 1 because it's:
|
Yeah I would say go for the first one. The problem is that then whenever the user opts for the second way the engine replaces it by the first one. |
I think we should keep it since it's valid JSON and the performance impact on deserialisation is minimal since it should not run more than a couple times (if not just once on startup) and it might be easier for a user to write. |
Problem
Currently you can read settings from file but not write back to it.
Solution
Add a method to the settings class (I kind of don't like this because everything I/O related to settings is in the plugin instead of the class)
Alternatives
Perhaps a system that runs periodically? Not a big fan
Store back to file on every change? Would be doable when #456 is implemented
The text was updated successfully, but these errors were encountered: