Hi,
I am working on a plugin and want to allow the user to browse through the system to choose an .app (Application) file on Mac.
Currently I'm using OpenDialog() function of SDKFileOpenChooser dialog for this. It's working correctly on Windows but on Mac, when the dialog opens up, .app file appears to be disabled (Not selectable).
Please tell me what filter should I add so that one can choose files with extension .app.
I am using SDKFileOpenChooser dialog. To add filter, we either need TypeInfoID for that file or FileType and extension.
Using this code, I found out the typeInfoID for .app files. It came out to be 291.
TypeInfoID tpID = FileTypeRegistry::GetFileTypeInfoIDForFile(appIDFile);
Then I tried to add filters in both ways, it's still appear to be disabled (not selectable). Thus, not allwoing to choose .app files.
SDKFileOpenChooser openChooser;
FileTypeInfo currentFiletypeInfo = FileTypeRegistry::GetCurrentFileTypeInfo(291);
openChooser.AddFilter(currentFiletypeInfo.GetFileType(), currentFiletypeInfo.GetFileExtension(), "App_Filter");
or
openChooser.AddFilter(291, "App_Filter");
openChooser.ShowDialog();
Can anyone please help me.
You could try SDKFolderChooser and see if that works. If it does you could try looking at the source for SDKFolderChooser (in <SDK>/common/SDKFileHelper.cpp), see how it gets the IOpenFileDialog, and see if you can add a filter to that directly to only let the user select .app files. Not sure if that will work, but it might be worth trying at least.
SDKFolderChooser also didn't work.
It seems InDeisgn API doesn't recognize .app extension. This is because when I used this code to add filter in File Chooser dialog, I found that extension being retrieved using GetFileExtension() is "Text" which is incorrect.
FileTypeInfo currentFiletypeInfo = FileTypeRegistry::GetCurrentFileTypeInfo(291);
openChooser.AddFilter(currentFiletypeInfo.GetFileType(), currentFiletypeInfo.GetFileExtension(), "App_Filter");
North America
Europe, Middle East and Africa
Asia Pacific