findChildFiles weirdness

The following code works fine in a standalone test, that is, it search the downloads dir for all files with a .lps extension.

juce::File dirToSearch("/Users/rwalsh/Downloads");
**auto** presetFiles = dirToSearch.findChildFiles (juce::File::TypesOfFileToFind::findFiles, **false** , "*.lps");

However, when I try the same code in a standalone plugin it always returns 0. I’ve never had any any issues with this method before. Anyone have any ideas?

Could it be an entitlements issue? Has your standalone been granted access to the user downloads folder?

Thanks for the quick reply, I have added to my HARDENED_RUNTIME_OPTIONS, but still nothing. This test app project was generated using the Projucer, while the standalone project was created using CMake. This is the relevant section of my CMakeLists.txt:


It’s surely something to do with permissions, maybe I’m not setting the entitlements correctly?

If you’d already configured the build for the project before you added the new hardened runtime option, perhaps the plist wasn’t updated correctly when the project was reconfigured. Have you inspected the plist of the built app to check that it has the correct contents?

If the plist is incorrect, could you try configuring the project from scratch and see whether that helps?

I just deleted my entire build folder, ran CMake again with these options, and still nothing. I have to leave this for now, but when I get a chance later I will generate a basic plugin example with CMake and see if I have the same issues there. Thanks again, I’ll get back to you later.

It turns out the app had everything selected but downloads, in the MacOS Security and Privacy settings. Not sure why, but enabling that fixed the issue, thanks again.