[Qt-interest] What should I use to delete non-empty directories?
R. Reucher
rene.reucher at batcom-it.net
Mon Sep 14 10:06:16 CEST 2009
On Mon, 14 Sep 2009 09:31:44 +0200, Radosław Papierski wrote:
> I'm trying to delete a non-empty directory. Which model/class should I
> use? I tried QDirModel, but it returns false when trying to rmdir.
>From rmdir(3p) - the POSIX standard:
If the directory is not an empty directory, rmdir() shall fail and set
errno to [EEXIST] or [ENOTEMPTY].
> As a sidenote, it's really annoying there's no return/error codes in Qt.
You can always use errno.h if you want to get the last return codes of
system(-specific) calls! But again, Qt follows the POSIX standard here,
and so return false in that case is just fine (errno can only be
ENOTEMPTY in this case).
If you need recursion, simply implement that yourself i.e. by sub-
classing from QDirModel.
HTH, René
--
René Reucher
rene.reucher at batcom-it.net
http://www.batcom-it.net/
More information about the Qt-interest-old
mailing list