[Development] QFile: writing via a temporary file

Artur Souza (MoRpHeUz) artur.souza at openbossa.org
Fri Jan 6 13:50:14 CET 2012


On Thu, Jan 5, 2012 at 8:32 PM, David Faure <faure at kde.org> wrote:
> Now there's just one question remaining: even if the rule is that all
> operations apply to the temp file, between open and close... what should
> QFile::fileName() return? The temp file name, to obey that rule, or the target
> file name, for symmetry with setFileName()?
>
> I'm tempted to say: the latter, because the temp file is really internal, and
> to prevent surprises (breaking symmetry with setFileName). Of course it means
> file.remove() won't be the same as QFile::remove(file.fileName()) anymore... :)

But imagine the following scenario:

file.setUseTemporaryFile(true)
file.open()
file.write()
----> APP CRASHES

If file.fileName() would return the original filename, how one can
restore the temp file? Would the temporary filename be deterministic?

Cheers,

-- 
-------------------------------------------------------
Artur Duque de Souza
openBossa
INdT - Instituto Nokia de Tecnologia
-------------------------------------------------------
Blog: http://blog.morpheuz.cc
PGP: 0xDBEEAAC3 @ wwwkeys.pgp.net
-------------------------------------------------------



More information about the Development mailing list