Bug on DirectoryContentsList setDirectory ? [ RESOLVED ]


#1

Edit: found the problem, user error, not Juce. :oops:

Juce, when using setDirectory in a DirectoryContentsList object in real-time, it doesn´t update the root item name. Is this a bug? Or I must do this in another way? (which I haven´t figured out yet)

Latest Juce files. (July 23 2013)

[code]DirectoryContentsList* directoryList;

directoryList = new DirectoryContentsList (0, thread);
directoryList->setDirectory (folder, true, true);
thread.startThread (3);[/code]

while (directoryList->isStillLoading()) { ; } directoryList->setDirectory(File("C:\\temp"), true, true);

Thanks.


#2

Maybe call refresh()?


#3

Thanks, but that didn´t work. Doing on the DirectoryContentsList doesn´t change the root name, and doing on the TreeView just crashes.

Maybe a quick solution would be able to just rename Root?

Thanks again. :oops:


#4

You’re not explaining your problem very well… Calling DirectoryContentsList::setDirectory() will definitely set its root folder - i.e. a subsequent call to DirectoryContentsList::getDirectory() will return the new folder. Presumably you’re actually talking about some other class that’s not picking up this change? And how are TreeViews involved?


#5

Oops, you are right, its the FileTreeComponent.

FileTreeComponent* treeView;
addAndMakeVisible (treeView = new FileTreeComponent(*directoryList));

Nothing else. So I wonder if the FileTreeComponent is missing something?


#6

Now, more info, if I do:

directoryList->setDirectory(File(audioProcessor->dataFiles->dataFilesString + MODULES_FOLDER), true, true);
treeView->refresh();

I see that the root item name changes BUT crashes right after that.


#7

HOLD! I found the problem, and it was MY mistake. Terrible sorry about this… :oops: