Launching an application with associated files - Mac vs. Win

Hey Jules
I’ve just noticed a situation that is handled differently on Mac than it is on Windows.

When opening a file which is associated with my Juce app, hence causing it to launch my app, on Mac the app gets the files path using anotherInstanceStarted (const String& commandLine) whereas on Windows it gets the files path using initialise (const String& commandLine), both within the JUCEApplication class.

Is this deliberate? The way Windows handles it makes more sense to me, and it would be great if Mac could handle it the same way. When opening an associated file whilst the app is already open, anotherInstanceStarted() is used by both platforms.


If allowMoreThanOneInstance is true, then on Windows it’ll actually be starting up another instance. If you disable it, it should work like the mac.

I’ve got allowMoreThanOneInstance set to false.
Does it not make more sense that if the app is being initially launched via a file, the commandLine String within initialise() on both Mac and Win will contain the clicked files path? Currently only Win does. An issue I’m having on mac is that if i’m initially launching my app via a file I preferably need to know what file this is within the initialise() function, rather than anotherInstanceStarted() being called afterwards. Or am I missing some other logic?

Maybe, because I use this stuff in things like the introjucer, and it works AFAICT.

OK, I’ll have a look at the introjucer code and see if that helps.