Browse Source

Fix for sandboxed OSX filechoosers.

tags/2021-05-28
jules 13 years ago
parent
commit
7dafc1e836
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      modules/juce_gui_basics/native/juce_mac_FileChooser.mm

+ 13
- 0
modules/juce_gui_basics/native/juce_mac_FileChooser.mm 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;


Loading…
Cancel
Save