[Development] QTemporaryDir API

lars.knoll at nokia.com lars.knoll at nokia.com
Fri Nov 18 13:08:43 CET 2011


On 11/18/11 11:59 AM, "ext David Faure" <david.faure at kdab.com> wrote:

>On Friday 18 November 2011 11:32:09 Olivier Goffart wrote:
>> On Friday 18 November 2011 05:01:44 Jason A. Donenfeld wrote:
>> > A general [static] recursive remove directory function belongs in
>>QDir.
>> > 
>> > A member recursive remove *this* particular *temporary* directory
>> > function belongs in QTemporaryDir.
>> > 
>> > Putting a generalized recursive remove directory function into
>> > QTemporaryDir makes no organizational sense.
>
>Did you read the argumentation at
>http://developer.qt.nokia.com/forums/viewthread/9860/
>?
>
>One good reason for having it there, is that there are tons of different
>ways 
>to handle errors. And the way that it picked by QTemporaryDir::removeDir
>is to 
>keep going as much as possible.
>
>When removing a user's directory, maybe you want to stop at the first
>error, 
>instead. Or to pop up a dialog about the error and offer
>continue/abort/skip/etc.
>
>So for the one particular implementation of "remove as much as possible
>in 
>order to free space in /tmp", having it in QTemporaryDir makes sense.
>
>> I agree with that,  IMHO it belongs to QDir.
>> 
>> About the fact that the function is dangerous, yes it is,  but it is
>> something developers want to do anyway, and not only with temporary
>> directories.
>
>I agree that "dangerous" is not a valid argument, QFile::remove is
>dangerous 
>too. But error handling is a valid argument.
>
>The alternative is to have QDir::removeRecursive(StopOnError |
>ContinueOnError) of course. I'd be fine with that. But apparently we
>still 
>need to convince Lars that it's ok :)

Something like that sounds ok. Certainly better then having the thing in
QTempDir.

Cheers,
Lars




More information about the Development mailing list