CNewFileSelector ignoring type on OSX

A user interface toolkit mainly for audio plug-ins (VST, AudioUnit, etc).
f.berti
Posts: 14
Joined: Thu Nov 02, 2017 5:50 pm

CNewFileSelector ignoring type on OSX

Postby f.berti » Mon Dec 18, 2017 10:57 pm

Hello,

I'm building a file selector using this code:

Code: Select all

loadFileSelector = CNewFileSelector::create(getFrame(), CNewFileSelector::kSelectFile);
   
if (loadFileSelector)
{
   loadFileSelector->setDefaultExtension(CFileExtension("JSON file", "json"));
   loadFileSelector->setTitle("Choose a sound bank file...");
   loadFileSelector->run(this);
   loadFileSelector->forget();
}

When the select file dialog appears on OSX (I'm testing it on 10.10, building for 10.7 target), I keep seeing all the files as selectable, while I was expecting to see only the file with the extension specified ("json" in this case) as selectable and the rest greyed out.

I did some debugging on macfileselector.mm and this block of code is getting executed:

Code: Select all

   
if (openPanel)
{
#if MAC_COCOA
   if (parentWindow)
   {
      setupInitalDir ();
      openPanel.allowedFileTypes = typesArray;
      remember ();
      [openPanel beginSheetModalForWindow:parentWindow completionHandler:^(NSInteger result) {
         openPanelDidEnd (openPanel, result);
         forget ();
      }];
   }
   
   ...

Everything looks fine, I see the typesArray correctly containing the "json" string, but I'm still able to select all the files from the dialog window...
Am I missing something? Everything works as expected on Windows...

Thanks in advance,
Federico

Arne Scheffler
Posts: 187
Joined: Mon Jun 20, 2016 7:53 am

Re: CNewFileSelector ignoring type on OSX

Postby Arne Scheffler » Tue Dec 19, 2017 10:02 am

Hi Federico,
have you tried to add the UTI to the file extension ?

Code: Select all

CFileExtension("JSON file", "json", "application/json", 0, "public.json")


Cheers,
Arne

f.berti
Posts: 14
Joined: Thu Nov 02, 2017 5:50 pm

Re: CNewFileSelector ignoring type on OSX

Postby f.berti » Tue Dec 19, 2017 8:24 pm

Arne Scheffler wrote:Hi Federico,
have you tried to add the UTI to the file extension ?

Code: Select all

CFileExtension("JSON file", "json", "application/json", 0, "public.json")


Cheers,
Arne

Same result, I can still select any type of file :(

Arne Scheffler
Posts: 187
Joined: Mon Jun 20, 2016 7:53 am

Re: CNewFileSelector ignoring type on OSX

Postby Arne Scheffler » Wed Dec 20, 2017 12:08 pm

Can you post a screenshot of the file selector ? I'm not sure if what you see is just the way it works on macOS.

f.berti
Posts: 14
Joined: Thu Nov 02, 2017 5:50 pm

Re: CNewFileSelector ignoring type on OSX

Postby f.berti » Wed Dec 20, 2017 9:54 pm

Here you go.
As you can see, all the files are selectable, regardless of the file type.
I'd like to filter out non-"json" files in order to help the user, like in Windows.
You do not have the required permissions to view the files attached to this post.

Arne Scheffler
Posts: 187
Joined: Mon Jun 20, 2016 7:53 am

Re: CNewFileSelector ignoring type on OSX

Postby Arne Scheffler » Thu Dec 21, 2017 7:55 am

OK, this indeed looks wrong. Did you check another host, just to make sure that it is not Reaper causing this ?
Other than that I've no clue, I'm using the file selector successfully in many projects.

Cheers,
Arne

f.berti
Posts: 14
Joined: Thu Nov 02, 2017 5:50 pm

Re: CNewFileSelector ignoring type on OSX

Postby f.berti » Thu Dec 21, 2017 9:41 pm

Arne Scheffler wrote:OK, this indeed looks wrong. Did you check another host, just to make sure that it is not Reaper causing this ?

Damn, it works correctly in Logic and GarageBand... :x
Thanks for the tip, Arne!


Return to “VSTGUI”

Who is online

Users browsing this forum: No registered users and 1 guest