Not sure if you figured this one out, but if not (and for future searchers) the way to do this is actually (after hours of searching!) very simple with juce.
You put your file open handling code in your overridden:
JUCEApplication::anotherInstanceStarted (const String& commandLine)
and the commandLine passed into here will be the filename of the file dragged onto the app icon (or double clicked if an associated file).
The reason this works is because Juce DOES handle the ‘odoc’ apple event in the AppDelegateRedirector class in juce_mac_MessageManager.mm, and calls the JUCEApplication’s anotherInstanceStarted method with the filename.
Not totally obvious or documented, but works
And yes it seems to work fine even if another instance isn’t already running, I guess the Mac Launch Services launches your app, then sends the odoc (Open Document) event to another instance of the delegate, which realises the first instance is already running and calls it’s ‘anotherInstanceStarted’ method.[/quote]
Hi graffiti and amygdala,
Which version of juce are you guys using. Because I have implemented “anotherInstanceStarted” but when my custom files are clicked I don’t get the file path. I just get a string of this form “-psn_0_159783”. Did you guys make any changes to info.plist of your application ? Any help on this matter will be highly appreciated.