orstools-qgis-plugin
orstools-qgis-plugin copied to clipboard
Move the config-yaml to general plugin folder to avoid deletion when plugin is updated.
What happens if we have an update for the config file, new parameters etc., and there is still an old one in the permanent location?
Currently there will probably be a permission denied error. One way to solve this could be adding the plugin version to the config file and checking for it, overwriting the old config file when theres a new version.
Currently there will probably be a permission denied error. One way to solve this could be adding the plugin version to the config file and checking for it, overwriting the old config file when theres a new version.
Wouldn't that be the opposite of what this issue targets to achieve?
The way the current code in this PR handles it is every time the plugin is reloaded or QGis is started, in the init, there's a check that compares the plugin version with the version of the config file. If there's a difference, the old providers will be copied. For the case that new parameters (or such) are introduced, @TheGreatRefrigerator and I concluded that a custom logic to incorporate them has to be included. I.e. we can't care for the new parameters in advance. There are warning comments in the init and the config-yaml.
Maybe this is too much trouble for this issue?
Right now, we only keep the providers. Imo, that is fine how it is now. Maybe it's worth keeping an additional logic in case we modify the provider selection somehow. Old config structures shouldn't break new configs. If we're not going to change the provider logic, we could also just merge how it is now.
@Merydian What do you think?
The problem i still see is potential issues with the config-yaml being in the plugin folder. I am not certain on how we can make sure there's nothing wrong with that.
The problem i still see is potential issues with the config-yaml being in the plugin folder. I am not certain on how we can make sure there's nothing wrong with that.
@koebi or @TheGreatRefrigerator what do you think?
Maybe we should look into moving our settings to the QGIS plugin settings: https://docs.qgis.org/3.28/en/docs/pyqgis_developer_cookbook/settings.html?highlight=storing%20settings
We could just JSON.dumps the config object.
Maybe this blog post is of relevance here?