FileChooser && localhost


#1

MacOS 10.11.6

So I’m seeing an odd thing…

In my plug-in if I use a native FileChooser to select a file, in Pro Tools 12.8 the path is:

/Users/{USERNAME}/....

but if I use Pro Tools 12.5 the path is prepended by /localhost:

/localhost/Users/{USERNAME}/....

and if I use File::existsAsFile() on the latter it fails to find the file.

Any ideas?

Thanks,

Rail


#2

As a quick (and dirty) fix I just added:

File URL::fileFromFileSchemeURL (const URL& fileURL)
{
    if (! fileURL.isLocalFile())
    {
        jassertfalse;
        return {};
    }

    auto path = removeEscapeChars (fileURL.getDomain()).replace ("+", "%2B");

   #ifndef JUCE_WINDOWS
    path = File::getSeparatorString() + path;
   #endif

    auto urlElements = StringArray::fromTokens (fileURL.getSubPath(), "/", "");

    for (auto urlElement : urlElements)
        path += File::getSeparatorString() + removeEscapeChars (urlElement.replace ("+", "%2B"));
    
    if (path.startsWithIgnoreCase ("/localhost"))   // <<<----  Added
        path = path.substring (10);                 // <<<----  Added
    
    return path;
}

Rail


#3

I am getting this same issue in Mac Os 10.13.2 and a VST plugin build. Curiously this thing indeed seems to be related to a plugin format build as the Juce standalone “plugin” build does not suffer from the issue! (So far I saw the bug happening when running the plugin in Reaper, Ableton Live and Plogue Bidule.)


#4

It’s host related though… the same binary acts differently depending on if it’s Pro Tools 12.5 vs 12.8

Rail


#5

Happens here as well with ProTools 12.5.x.

Wolfram


#6

Yeah,

I’ve not seen it happen with any other hosts I use for testing… Logic, Cubase, Nuendo, Studio One, Reaper, Live 9, Digital Performer, Sonar, Tracktion… and I don’t believe it was happening in any other version of Pro Tools except 12.5

Rail


#7

Running in Live 9 (very old install) and REAPER (latest) I get a /localhost, prefix.

Running in Logic Pro X (latest) and the JUCE Demo host there’s no prefix.

Does anyone know what’s going on?


#8

Related to this one?

I have a problem to load a text file via FileChooser.
Standalone version of my plugin can load a file correctly,
but VST version can’t.

I use Xcode 9.2 on macOS 10.13.2.


#9

You can’t load a text file correctly because of a leading /localhost or some other reason?


#10

I don’t think this issue is related to the other one.


#11

Let me ask Avid if they can shed some light on how they compiled 12.5 which is different to 12.4 and 12.7 which could cause this.

Rail


#12

Yes, it’s because /localhost thing.
Standalone version doesn’t have this thing,
but with VST version on Ableton Live, “/localhost” is prepended to full path of a file.

I don’t remember well but since update to Xcode9.2, I think I have this thing.


#13

More likely introduced with this commit:

where they changed to using NSURL for the paths. My fix in the second post in this thread works well.

Rail


#14

hmmm, the only difference I can see is how we get the underlying path from the OS. Instead of:

results.add (File (nsStringToJuce ([[panel URL] path])));

we now have:

chooserResults.add (URL (nsStringToJuce ([[panel URL] absoluteString])));

Are you saying that if you replace the above line with something like:

auto scheme = nsStringToJuce ([[panel URL] scheme);
auto path = nsStringToJuce ([[panel URL] path]);
chooserResults.add (URL (scheme + "://" + path));

then it works for you?


#15

Yes, in 12.5 changing to:

        if (isSave)
        {
            // chooserResults.add (URL (nsStringToJuce ([[panel URL] absoluteString])));
        
            auto scheme = nsStringToJuce ([[panel URL] scheme]);
            auto path = nsStringToJuce ([[panel URL] path]);
            chooserResults.add (URL (scheme + "://" + path));
        }

loses the prefix.

Rail


#16