[Qt-interest] how to destroy a dir, no matter if any files in it or not.
James Yan
jyan972 at gmail.com
Tue Mar 23 18:49:35 CET 2010
is any handy API do this?
OR why my function fail to do that :
//clear dir
void myClearDir(QString strDir)
{
QDir dir(strDir);
//clear the files
QStringList fl = myListFiles(strDir,"*.*",true,false);
for(int i=0;i<fl.size();i++)
{
dir.remove(fl.at(i));
}
//list dir and recall this func
QStringList dl = myListDirs(strDir,true);
for(int i=0;i<dl.size();i++)
{
myClearDir(dl.at(i));
dir.rmdir(dl.at(i)); // always return false, fail to delete the
empty dir? why?
}
}
More information about the Qt-interest-old
mailing list