FileTreeComponent (bug or feature?)


#1

The FileTreeComponent class implements "does-not-include-files" filtering only at the root level.

All subsequent child items of the tree are not filtered at all but always include both - files and directories.

To fix this "bug-or-feature" I suggest small changes to the DirectoryContentsList and FileListTreeItem classes:

I suggest fixing an annoying flaw of the DirectoryContentsList class by adding the public function:


    /** Returns current file type flags. */

    int getFileTypeFlags() const { return fileTypeFlags; }

...and finally we change one line of the FileListTreeItem​::itemOpennessChanged function from this:

l->setDirectory (file, true, true);

to this one:

l->setDirectory (file, parentContentsList->getFileTypeFlags() & File::findDirectories, parentContentsList->getFileTypeFlags() & File::findFiles);

 

Those changes may affect someone's code who count on old behaviour.

 

Again, I hope this fix makes JUCE library better.

Best regards.


#2

Thanks! I've checked something in (not tested - give it a try!)


#3

Sorry, Julian, but I cannot see any chages in the git repository.

Are you sure you've checked your chages in?


#4

I'm seeing the commit here.

 

[edit]  

Are you using: git://github.com/julianstorer/JUCE 

I had to change whatever git repo I had set up for JUCE a few weeks back as I noticed i was getting no new commits,


#5

Thank you, Valley!

Yes, you were right. I've used a wrong GIT URL.


#6

Yes, Julian!

It works like a charm.

Thank you!