@jules
Reproduction:
ArgumentList::Argument arg;
arg.text = “–foo”;
jassert(arg.getLongOptionValue().isEmpty());
The current implementation is:
String ArgumentList::Argument::getLongOptionValue() const
{
if (isLongOption())
// wrong check, only false if '=' is the first char!
if (auto equalsIndex = text.indexOfChar ('='))
return text.substring (equalsIndex + 1);
return {};
}
I think it should be:
String ArgumentList::Argument::getLongOptionValue() const
{
if (isLongOption())
{
auto equalsIndex = text.indexOfChar ('=')
// correct check: indexOfChar return -1 if character could not be found
if (equalsIndex != -1)
return text.substring (equalsIndex + 1);
}
return {};
}
best,
Ben
PS.: The somewhat longer story is that ArgumentList::getExistingFolderForOption("–foo") prints a confusing error message (Could not find folder: /Volumes/…/–foo ) if the user tries to pass the arguments via “–foo /bar/baz” instead of “–foo=/bar/baz”