I have an editor and some files opened. I do some changes and don't save them. For some reason my app crashes.
After that I run the app again and want the editor to show the message like: "The system crashed unexpectedly. There are some changes in your files that weren't saved. Do you want to recover them or load the original state?"
I want to implement something like that.
The first thought was to create a Temp folder which is used to keep modified copies of the original files. These copies are updated every change in the editor or in regular time as autosave. When I click Save, the temp copy just replaces the original. If system crashes I choose either the temp or the original to load.
The second one is to save change log in associated file as for Undo/Redo mechanism and redo things step by step if needed. But it's too expensive and hard to implement in comparison.
And the third is to save modified data copy in the same file with original data (if data is not too big of course) and act like in the first case but without Temp folder.
So are there any patterns, typical approaches or data structures for that issue?
Aucun commentaire:
Enregistrer un commentaire