Better extensions management in FileChooser


#1

Hello Jules,
I would like to submit a change to the FileChooser class when using the native dialog boxes on Windows and Mac.
The change has no impact on existing code but improves, if so desired, the way Juce currently manages multiple formats when opening or saving files.

To use the new feature, just replace the current filter specification, for example:"*.one;*.two"
with the following:"*.one|Type one document;*.two|Type two document"
I’m attaching the involved files. Let me know what you think.


#2

Thanks… Your code’s helpful but it’d take me quite a long time to add linux and non-native versions, and sanity check it, for quite a minor feature… I’ll put it on my to-do-list but am rather busy at the moment!


#3

Dear Jules,

I am not questioning your priorities in the development of Juce, but I think this is by no means a minor problem. With the current code, the choice of the format to save the data is left to the accuracy with which the user types the file extension. In addition, the way the filters are represented in Windows is simply wrong.

As for Linux, I see in the FileChooser class constructor:#if JUCE_LINUX useNativeDialogBox = false; #endifTherefore, currently it is simply not possible to use a native dialog on this platform.

Actually, to complete the discussion it would be necessary to modify the FileBasedDocument class to accept two distinct sets of formats for reading and writing.

Of course I will use my code, but the idea of ​​having to check with each update from the tip if these files have been modified and proceed to integration on two different platforms does not attract me at all.

I trust in your tried willingness, hoping that once you have a little spare time you’ll accept my request.
Thanks as always for your work on Juce from a guy who has spent the last weekend trying to learn Objective-C and Cocoa enough to write this code. :slight_smile: