Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QDir::entryInfoList returns wrong results



  • Why does the following Qt 4.8.2's code:

    @
    const QDir dir( ... );
    const QList< QFileInfo > dirs = dir.entryInfoList( QDir::AllDirs );
    @

    ... returns not only the directories inside dir but the dir's path and its parent folder's path?



  • Because the directory <code>.</code> and the parent directory <code>..</code> are directory entries as well. If you do not want them to be listed use <code>QDir::NoDotAndDotDot</code>.


Log in to reply