getCommandLineParameterArray() drops 1st argument - why?


#1

There is some ancient consensus that the first argument to main() is the path to the executable itself.

getCommandLineParameterArray() discards this. Why?

What would be the proper way to get that information?


StringArray JUCEApplicationBase::getCommandLineParameterArray()
{
    return StringArray (juce_argv + 1, juce_argc - 1);
}

Regards,

Stefan

 

 


#2

What about File::getSpecialLocation(File::currentExecutableFile)?

https://www.juce.com/doc/classFile#a3e19cafabb03c5838160263a6e76313dab960741272c75e94482f295a516aae62 ?

currentExecutableFile / invokedExecutableFile 

Does this what you want?

Best,
Ben


#3

getCommandLineParameterArray() discards this. Why?

I vaguely remember that it was because on Windows that wasn't the way things worked, so dropping that arg and providing other ways to find the exe was the most cross-platform design.


#4

Thanks Ben, this kind of works for me.