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

Nicolas Goutte nicolasg at snafu.de
Tue Feb 28 08:12:45 GMT 2006

The attached patch is for branches/KDE/3.5/kdelibs/kdecore

The patch adds a function KStandardDirs::removeDir to remove a directory and 
its contents (recursively). This more intended for directories under the 
control of the computer (as opposed to KIO::NetAccess:del where there is user 
feedback for long operations).

The goal is to use it in KTempDir:.unlink to replace the ::system( "/bin/rm 
-rf something") call, which is not portable.

I have tried to program the function defensively to avoid potential traps. If 
I have missed any trap, please tell.

I have chosen to add it to KStandardDirs as there is
KStandardDirs::makeDirs and also other functions using the opendir/readdir/
closedir functions.

If you are ok with it, I will commit the patch for KDE 3.5.2 and then port it 
to KDE4.
(By the way, I have tried to ask Qt Bugs for such a function in QDir (issue 
N104800) but it was refused.)

Have a nice day!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: removedir.diff
Type: text/x-diff
Size: 4359 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060228/4e128c5d/attachment.diff>

More information about the kde-core-devel mailing list