Create backup file when writing new xml file?
faure at kde.org
Mon Feb 17 01:42:44 UTC 2014
On Sunday 16 February 2014 19:52:36 Thiago Macieira wrote:
> The simplest operation is to write to a temp file, then rename the original
> to the backup name, then rename the temp to the original name. However,
> what happens if the application crashes between renames? You've got a temp
> and a backup, but no file.
Isn't that good enough? That's what backups are for. The usual way to use a
backup is for the user to rename it to the proper name (e.g. remove ".backup")
and open it with the application, isn't it?
Alternatively, the application can automatically look for the backup file if
the main file doesn't exist anymore (e.g. when attempting to reopen the file
via session management or via "recent documents").
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5
More information about the subsurface