Create backup file when writing new xml file?

Linus Torvalds torvalds at linux-foundation.org
Mon Feb 17 10:01:59 UTC 2014


On Sun, Feb 16, 2014 at 5:35 PM, Thiago Macieira <thiago at kde.org> wrote:
>
> Instead, I'd recommend that save_backup not take as a parameter the
> recommended extension. Simply remove the part after the ending dot, whatever
> it might be, and replace it with .bak.

I guess I would be ok with that, or even just appending ".bak" on top
of any existing one.

I was a bit nerous about scanning pathnames, since you'd also want to
stop at the path component separator, but I guess it would be easy
enough to scan backwards until you find a dot, or either of '/' or
'\'. And if you don't find a dot, we can just append ".bak" to the
whole thing.

                Linus


More information about the subsurface mailing list