1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fix for sandboxed OSX filechoosers.

This commit is contained in:
jules 2013-02-07 09:52:19 +00:00
parent ad33fca65a
commit 7dafc1e836

View file

@ -148,6 +148,16 @@ private:
SilentDummyModalComp dummyModalComponent;
};
static NSMutableArray* createAllowedTypesArray (const StringArray& filters)
{
NSMutableArray* filterArray = [[[NSMutableArray alloc] init] autorelease];
for (int i = 0; i < filters.size(); ++i)
[filterArray addObject: juceStringToNS (filters[i].replace ("*.", ""))];
return filterArray;
}
//==============================================================================
void FileChooser::showPlatformDialog (Array<File>& results,
const String& title,
@ -186,6 +196,9 @@ void FileChooser::showPlatformDialog (Array<File>& results,
[panel setTitle: juceStringToNS (title)];
if (filters->size() != 0)
[panel setAllowedFileTypes: createAllowedTypesArray (*filters)];
if (! isSaveDialogue)
{
NSOpenPanel* openPanel = (NSOpenPanel*) panel;