Closed davbeek closed 21 hours ago
First of all, any file that has content you don't want to lose, make a backup. Simplest is a git repo, although that doesn't protect against disk crashes.
Another step can be to overwrite only after confirmation by the user.
Other options are not specifying a file path to a settings file, but have them all in one separate directory, and get them by their name in that directory. In that way, you can move the settings files out of the way from directories where more dangerous file movements happen.
I can intentionally overwrite settings several times in succession, so confirmation would not work, I would simply always answer yes. I usually switch off almost all confirmations. Actually, overwriting is not really a big problem, as settings files can easily be recreated by saving the state of the GUI.
Having a separate dir to store various setting files could be useful, but I can also image that some users would want to store their setting files in their repos or projects. That is how the Waldenberg gitinspector worked, by storing the settings in the git config files.
Maybe have several configurations in your setting file?
In the general case, I think it's hard to find a solution if you both want it easy to overwrite a settings file and at the same time don't want to loose such files.
Making backup file(s) could work, although finding the correct settings file again is a mess probably.
Basically it works by renaming an old file named file
to file.1
, and then write a new file
.
This can be done with more files, eg if file.1
already exists, first rename that to file.2
. and so on.
An alternative is to keep existing old file.1
and rename file
to file.2
the next time before overwriting it again.
Usually there is an upper limit on how many files you want to keep.
Solved by adding the settings file location in a text box and adding a button to toggle between displaying the full path or only the stem. Saving the settings also saves the toggle value to either display the full path or stem.
Full path:
Stem without .json extension:
I expect that unintentionally overwriting the settings is now unlikely, because the Save button is next to the name of the settings file. It is also very helpful to be able to easily see which settings file you are working on.
I hope I have fixed any remaining bugs so that this is done, closing.
I created an additional settings file in the folder of the student submissions, but unknowingly overwrote it with several experiments.
The problem is that it is nowhere visible which settings file you are working with. This should be much more obvious, otherwise it is very easy to unintentionally overwriting settings files, so that having different setting files for different purposes becomes more or less useless.