jiayouxjh / grafx2

Automatically exported from code.google.com/p/grafx2
0 stars 0 forks source link

Make Safety backups record the original filename #318

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Today, when a file is recovered after a crash, it's located in the
program's config directory and named a000000.bkp for example. The bad thing
is that if the user simply right-clicks "save", the file is only
overwritten in-place (a temporary location), and the user may think he has
successfully recovered his original. I have put an explaination in the
message box, but I'm still afraid somebody loses a file simply because he
hasn't understood the system.

Instead, I could make the restored files 'point to' their original
directory and file name. This way, on "Save" it will successfully salvage
the image in a safe location. Even "save as" will work better, as it will
target the original directory.
A bad side is that the backup "number" will no longer appear in filename
(000, 0012, 0025), so when the user browses history with Undo/Redo, he will
have no hints to tell him when he's at last image (Except the "noname.gif"
image that should be oldest).

Technically, it can be done by storing the file+directory in a GIF
extension chunk. These are undocumented and uncompressed pieces of data
that you can include in the file, and they are limited to 256 bytes.
Fortunately a filename+path will fit.
On safety save init, the full filename will be stored in a new field.
On GIF save, if this field is present, the chunk must be created.
On GIF load, if this field is present, read it and override the context's
variables.
Load_image() will automatically copy the fields from context to "history".

Original issue reported on code.google.com by yrizoud on 17 Feb 2010 at 2:54

GoogleCodeExporter commented 9 years ago
What about replacing the extensio nwith 001, 002, ... instaed of the filename ? 
We 
know we save them as gif anyway, and an emergency backup is not meant to be 
used by 
others programs...

Original comment by pulkoma...@gmail.com on 17 Feb 2010 at 3:00

GoogleCodeExporter commented 9 years ago
Still need the directory. (Also, 3 digits will wrap after 17 hours of continuous
drawing :)

Original comment by yrizoud on 17 Feb 2010 at 3:20

GoogleCodeExporter commented 9 years ago

Original comment by yrizoud on 17 Feb 2010 at 3:43

GoogleCodeExporter commented 9 years ago
Done in r1467

Original comment by yrizoud on 16 May 2010 at 2:57