qt - Check if directory is empty -
i'm trying check if directory empty.
mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent), ui(new ui::mainwindow) { ui->setupui(this); qdir dir("/home/highlander/desktop/dir"); if(dir.count() == 0) { qmessagebox::information(this,"directory empty","empty!!!"); } }
whats right way check it, excluding .
, ..
?
well, got way :)
if(qdir("/home/highlander/desktop/dir").entryinfolist(qdir::nodotanddotdot|qdir::allentries).count() == 0) { qmessagebox::information(this,"directory empty","empty!!!"); }
Comments
Post a Comment