Hi all,
Adding to previous post, I have fixed command line issue in my application . I observed while debugging that command line argument( i.e. argv[1]) is not properly coming
( i.e. like “-psn_0_1594432”) in “anotherInstanceStarted()” while clicking on any custom file to launch the app and load the file because application is launching modelless windows before app main window and not loading the file. so just I have started a timer in “initialise()” method for 1 sec so that " _command = cmd " will be set properly and
then load the modelless window.
I have written following code.
void JuicerApp::initialise (const juce::String& cmd)
{
_command = cmd;
#ifdef JUCE_MAC
/* This will set initialisation true, and starts a timer(e.g new thread) for 1 sec that will do the initialisation
and first thread will call anotherInstance started there _command will be set with proper value. */
_bIsAppInitialisedFirstTime = true;
startTimer(1000);
#else
initialiseWithModellessWindow(_command);
#endif
}
void JuicerApp::timerCallback () {
stopTimer();
#ifdef JUCE_MAC
/* First time only in 30 milisec controll will come here from anotherInstanceStarted() and initialise the app and sets _bIsAppInitialisedFirstTime
to false so, now in second call only else part will be called with earlier set _command to load batch */
if(_bIsAppInitialisedFirstTime == true)
initialiseWithModellessWindow(_command);
else {
MY_AnotherInstanceStarted(_command);
}
_bIsAppInitialisedFirstTime = false;
#endif
}
void JuicerApp::anotherInstanceStarted (const juce::String& cmd)
{
_command = cmd;
#ifdef JUCE_MAC
startTimer(30);
#else
MY_AnotherInstanceStarted(_command);
#endif
}
I know Jules won’t accept it but i created all four type of App, Juce, Cocoa, Carbon C and Carbon C++ and got the same result in main(int argc, char* argv[])
argv[1] is always something like “-psn_0_1594432” . Please if anybody is finds a better solution do post in.