For whatever reason, when the app is sandboxed the open/save panels do not respect the filter extensions passed in to the FileChooser when going the native panel route.
For opening, all files are selectable instead of just those in the filter. For saving, the user must manually type in the extension because if they want to save foo.txt and they only type in foo, then the app will only be privileged for accessing foo (due to the way this particular entitlement works, only a ‘user-selected’ file may be read/written to). In our case, we were appending the extension after the file selection, but this won’t work when sandboxed because you only have access to foo, not foo.txt :roll:
Patching in juce_gui_basics/native/juce_mac_FileChooser.mm with the following seems to take care of the problem for both the open and save panels:
[panel setTitle: juceStringToNS (title)];
///////////////Adding this///////////////
NSMutableArray* filterArray = [[NSMutableArray alloc] init];
//First in array is the extension picked automatically by OS during save,
//so loop from 0 so that the first item in the filter string passed in to
//the FileChooser will be auto-appended. Also, setAllowedFileTypes wants
//just the extensions and no wildcard or leading dot.
for (int i = 0; i < filters->size(); i++)
[filterArray addObject: juceStringToNS((*filters)[i].replace("*.", ""))];
[panel setAllowedFileTypes: filterArray];
[filterArray release];