On Mon, 15 Nov 2010 08:57:51 +1100 Lex Trotman elextr@gmail.com wrote:
Also, g_file_replace_contents does have a make_backup argument we could provide an option for. This might handle the disk exhaustion problem.
To summarise the long thread for you Nick, g_file_replace_contents and g_file_replace can't be used because there is NO WAY to stop g_stream_close doing the rename of the temp file over the old file even if the write to the temp file fails. So you can get a broken output file.
I know. But at the least the user has the backup file then.
Attached is a patch to actually make the backup :-)
Ok. We do have some backup functionality in the Save Actions plugin, but anyway this pref may be more efficient.
I think either: 1. unsafe_save_backup should be renamed to gio_unsafe_save_backup to avoid confusion. 2. call the pref make_backup and make it work for all save implementations, and maybe have a GUI option for it.
Nick