should KSaveFile::simpleBackupFile overwrite old backups?

Allen Winter winter at kde.org
Tue Dec 23 21:59:01 GMT 2008


On Tuesday 23 December 2008 10:33:58 am Robby Stephenson wrote:
> Hi,
>
> I've run into some behavior with the KSaveFile::simpleBackupFile()
> functionality that I wanted to ask about. Essentially, the function doesn't
> do much more than append a backup extension (default is '~'), optionally
> modify the path, and then call QFile::copy().
>
> What I've run into is that QFile::copy returns false if the file exists. So
> while I would have expected repeated calls to simpleBackupFile() to
> repeatedly copy the existing file to the backup, it actually fails if the
> backup already exists. Am I reading that right?
>
> Is that the intended behavior? If so, perhaps we could add a note to the
> API saying the developer is expected to call QFile::remove() before backing
> up the file?
>
I don't think this should be the intended behavior.
I think repeated simpleBackupFile() should just work, without having
to call QFile::remove() in between.

> The KSaveFile::numberedBackupFile() function _does_ remove old copies
> first.
>
Good.  I think I worked on that. :)





More information about the kde-core-devel mailing list