AUv3 & user music directory

Hi!

I was under the impression, that AUv3 can access all files inside the user music directory.
But that does not seem to work for me.

I am targeting Mac/OSX here (not iOS).

I am using the JUCE special locations to find the path to the music directory: File::getSpecialLocation(File::userMusicDirectory);
And then I try to list all files inside the directory, using a JUCE File::findChildFiles() function.
That works fine for normal plugins (AU, VST, VST3). But not for AUv3.
In case of AUv3, the returned file list is always empty.

Here is my code:

File musicDir = File::getSpecialLocation(File::userMusicDirectory);
Array<File> childFiles;
musicDir.findChildFiles(childFiles, File::findFiles, false, String("*"));

For the AUv3, the childFiles Array is always empty.
What am I missing?

Is this maybe a sandboxing issue? Did you check which file path your call actually returns?

Hi PluginPenguin,
I guess it must have to do with Sandboxing.

Here is the path I get for the music directory:
/Users/martin/Library/Containers/com.MyCompany.MyPlugin.MyPluginAUv3/Data/Music
That is apparently a sandboxed path.

First I tried to use that very path for finding files. That did not work.
Turns out, the path is a symlink to the actual music directory located in /Users/martin/Music.
So next I tested to resolve the symlink using File::getLinkedTarget(). That correctly gives me the music directory as /Users/martin/Music.
But findChildFiles still returns empty. In both cases.

Or maybe it is a bug with findChildFiles? Hmmm…

Never worked with AUv3 myself, but if I got it right, they run their own process, right? I’m really no sandboxing pro, but can you be sure that the process actually has proper entitlements to access this directory?