FileChooser not appearing in Windows

Hi, anyone got any ideas why this code doesn’t pop up a file chooser?

auto *p_fc = new FileChooser( "Save Favourites", juce::File(), "*" );

p_fc->launchAsync(juce::FileBrowserComponent::saveMode | juce::FileBrowserComponent::canSelectDirectories,
                        [ = ](const juce::FileChooser &fileChooser) {
    const auto path = fileChooser.getResults()[ 0 ];
    
    DBG( "export_favourites: " << path.getFullPathName() );
} );

Works fine on Mac and I have similar code in other projects, but in this app no window appears and the callback is executed immediately.

thx

Perhaps this commit introduced a regression:

Are you using this commit? If so, please let us know the Windows version, plugin format, plugin host, and any other information that might be necessary to reproduce the problem.

If you’re not using this commit, please try updating and see whether the issue persists on develop.

1 Like

Is p_fc going out of scope too quickly and closing the chooser when it is destructed? Hard to know without a bit more of the context around that code.

Hi, thx.

The chooser appears if I remove the

juce::FileBrowserComponent::canSelectDirectories

from the options passed. Not sure if I actually need this, but maybe this should assert in debug so that callers know it’s an issue, or, the chooser should appear.

At any rate, I guess Windows and Mac should have the same behaviour.

thx