# Launching an application with associated files - Mac vs. Win

**URL:** <https://forum.juce.com/t/launching-an-application-with-associated-files-mac-vs-win/9426>\
**Category:** General JUCE discussion\
**Created:** [October 19, 2012, 3:11pm UTC](https://forum.juce.com/t/launching-an-application-with-associated-files-mac-vs-win/9426 "2012-10-19T15:11:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![liamtmlacey](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/liamtmlacey/32/82_2.png) [@liamtmlacey](https://forum.juce.com/u/liamtmlacey)\
**Post date:** [October 19, 2012, 3:11pm UTC](https://forum.juce.com/t/launching-an-application-with-associated-files-mac-vs-win/9426/1 "2012-10-19T15:11:49Z")

</div>

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.

Thanks.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [October 19, 2012, 3:40pm UTC](https://forum.juce.com/t/launching-an-application-with-associated-files-mac-vs-win/9426/2 "2012-10-19T15:40:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![liamtmlacey](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/liamtmlacey/32/82_2.png) [@liamtmlacey](https://forum.juce.com/u/liamtmlacey)\
**Post date:** [October 19, 2012, 4:03pm UTC](https://forum.juce.com/t/launching-an-application-with-associated-files-mac-vs-win/9426/3 "2012-10-19T16:03:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [October 19, 2012, 4:33pm UTC](https://forum.juce.com/t/launching-an-application-with-associated-files-mac-vs-win/9426/4 "2012-10-19T16:33:33Z")

</div>

> [@](#):
>
> Or am I missing some other logic?

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

---

<div class="post-metadata">

**Author:** ![liamtmlacey](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/liamtmlacey/32/82_2.png) [@liamtmlacey](https://forum.juce.com/u/liamtmlacey)\
**Post date:** [October 19, 2012, 4:59pm UTC](https://forum.juce.com/t/launching-an-application-with-associated-files-mac-vs-win/9426/5 "2012-10-19T16:59:07Z")

</div>

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