This parameter would allow a program to load a file from the commandline in an existing instance, while still allowing the user to start a new empty instance.
Isn’t that what the JUCEApplication::anotherInstanceStarted callback is for?
Yes, but that’s only called if moreThanOneInstanceAllowed() returns false.
I’d like to make the result of moreThanOneInstanceAllowed() depend on the contents of the command line, so I need to know it during that function.
Why would you use moreThanOneInstanceAllowed() to decide whether it should run or not? If you need to make a choice, just look at the command line params in your normal startup code, and if you don’t want the app to run, just quit.
I’m making a wave editor. When the user double-clicks a wave file in Explorer, it opens a new instance of the program and loads the wave in it.
However, the user may want to load the file into an existing instance instead of a new one. In that case, I need anotherInstanceStarted() to be called to load the file into the first instance (and then the second instance quits, of course). But when the user starts the program from (for example) the desktop icon, I’d like it to load a second instance.
It’s not vital to me that this is added to Juce (I’ve got it working here already, through a hack of the Juce code), but it would make it easier when I have to install a new version of Juce
It’s a small change, and I can’t think of any harm it would do (but I may just not think far enough).
Ah, I see what you mean now!
Ok, well I don’t want to add a parameter to moreThanOneInstanceAllowed, because that’d break a lot of code, but it’d be easy to store the command line params in the application object so you can get them. I’ll do that. Might be handy for other uses too.
Ok, that would work just as well. Thanks.