Open hillsandales opened 5 months ago
Rn there is one single function to load all different kinds of config files, resulting in overwriting the user file with the template if anything goes wrong during the load. Due to #228 the handling will most likely change in the future, probably resulting in a slightly different handling of program settings and parameter settings, solving this aspect here too.
I am not sure what would be the best way here instead of overwriting, either starting the program with an visible error message but still being able to create new parts without the functionality or just an error and closing the program right away. I tend to the first one.
@hillsandales Thanks for reporting, it does sound like a niche case scenario and hadn't really ran into it before. Sorry for the data loss... hopefully you got this going after all your effort. It is for sure a feature that needs a bit more polishing and I would appreciate any help improving it 😃
Given this custom file:
parameters_filters.yaml
If there's a formatting error on the first item in the list under a category, it causes the entire file to be overwritten by the default file.
If by accident, the file changes like this for one category:
When the program is re-launched, and the file is checked, the file is over-written and looks like this:
All custom settings are lost. I ran this same test, and added a parameter under a separate category as well. If an error shows up, that other category was also wiped
If an item further down the list is indented by accident like:
The new file when relaunched looks like this:
The item is moved up to the previous row, but the rest of the file is not over-written.
The terminal reported things like this:
So it appears to know where in the file something is formatted incorrectly.
Question: Why does the program automatically rewrite or reformat these config files? Is that necessary? Could it instead catch a format exception for the YAML and just exit before launching? If it doesn't launch due to a formatting error, it would allow the formatting error to be fixed and not lose custom settings.
I was changing a lot of these config files trying to get my parameters to populate when creating a part (which is proving difficult as the terminal reports they were not added but I can't figure out why from the output, but not related to this bug), and lost all my custom configured settings. :-(