[PATCH] Add a removeDir function to KDE 3.5.x

Nicolas Goutte nicolasg at snafu.de
Tue Feb 28 11:03:25 GMT 2006

On Tuesday 28 February 2006 10:55, Thiago Macieira wrote:
> Nicolas Goutte wrote:
> >On Tuesday 28 February 2006 09:22, Stephan Kulow wrote:
> >> Am Dienstag, 28. Februar 2006 09:12 schrieb Nicolas Goutte:
> >> > I have chosen to add it to KStandardDirs as there is
> >> > KStandardDirs::makeDirs and also other functions using the
> >> > opendir/readdir/ closedir functions.
> >>
> >> It for sure does not fit in that class. You are not supposed to delete
> >> a Standard KDE Dir. My suggestion: make this a global function in
> >> namespace KDE for KDE4 and a file static function to KTempDir in KDE
> >> 3.5.2.
> >
> >Ah, yes! I had not thought that some people could take it as invitation
> > to delete standard directories.
> >
> >As for KDE4, should be makeDir be moved too?
> No. For KDE4, use QDir stuff. If you don't find an equivalent (I don't
> think there is an equivalent of "rm -rf" there), let me know.

Sure, it would be the best that QDir could remove a non-empty directory, but 
cannot. (As written, it is Qt Issue N104800 and the wish was refused,)

If the removeDir function has to be done with QDir, it will be probably 
slower, as QDir filters, sorts and so on. (I am not even sure if QDir can 
handle hidden files.)

As for makeDir, there is not a direct equivalent either, as the one of KDE 
sets the permissions too (something that QDir cannot do and in 
QFile::Permissions there is the warning: "This behavior might change in a 
future Qt version.")

Have a nice day!

More information about the kde-core-devel mailing list