Hi,
The URL::launchInDefaultBrowser() method does not work on Mac if the URL string length is longer than 1024.
I found that the juceStringToNS instruction in the Process::openDocument method (juce_mac_Files.mm) never returns in that case.
bool JUCE_CALLTYPE Process::openDocument (const String& fileName, const String& parameters)
{
JUCE_AUTORELEASEPOOL
{
NSURL* filenameAsURL = [NSURL URLWithString: juceStringToNS (fileName)];
#if JUCE_IOS
(void) parameters;
return [[UIApplication sharedApplication] openURL: filenameAsURL];
#else
NSWorkspace* workspace = [NSWorkspace sharedWorkspace];
if (parameters.isEmpty())
return [workspace openFile: juceStringToNS (fileName)]
|| [workspace openURL: filenameAsURL];
...
As a result, I modified it like this to make it work:
if (parameters.isEmpty())
{
int iLength =fileName.length();
if(iLength <= 1024) // if length > 1024, juceStringToNS doesn't return
{
return [workspace openFile: juceStringToNS (fileName)]
|| [workspace openURL: filenameAsURL];
}
else
{
return [workspace openURL: filenameAsURL];
}
}