DirectoryIterator always checks for hidden file flag


Hi Jules,

I think there is a bug in :

    bool next (String& filenameFound,
               bool* const isDir, bool* const isHidden, int64* const fileSize,
               Time* const modTime, Time* const creationTime, bool* const isReadOnly)
        if (isHidden != nullptr)
                *isHidden = FileHelpers::isHiddenFile (fullPath);

In fact the isHidden bool* is never null because the bool it refers to is defined as a stack variable (then ==false) in juce_DirectoryIterator.cpp :

    bool isDirectory, isHidden;
    while ( (filename, &isDirectory, &isHidden, fileSize, modTime, creationTime, isReadOnly))

This makes scanning much more time consuming than it should be since the OS function getting the file flags is really slow…


Interesting point, thanks… I think I can optimise that for some cases if the File::ignoreHiddenFiles flag hasn’t been set.