Overview
The juce::FileChooser does not open in Logic Pro X, despite working as expected in the Standalone target. This was tested using a minimal example.
Steps to reproduce
- Clone the Pamplejuce repository
- Initialize submodules with
git submodule update --init --recursive
- Add
JUCE_MODAL_LOOPS_PERMITTED=1 to target_compile_definitions in CMakeLists.txt
- Replace the
PluginEditor::inspectButton callback with:
// this chunk of code instantiates and opens the melatonin inspector
inspectButton.onClick = [&] {
DBG ("Button clicked");
auto fileChooser = std::make_unique<juce::FileChooser> (
"Select a file",
juce::File::getSpecialLocation (juce::File::userHomeDirectory),
"*.wav;*.mp3");
DBG ("File chooser created");
if (fileChooser->browseForFileToOpen())
{
DBG ("File selected");
}
};
- Build using the Xcode generator (
cmake -B build -G Xcode, open build/Pamplejuce.xcodeproj)
Solution
This is an issue with entitlements on MacOS. This can be fixed by adding the following options to the juce_add_plugin() call in CMakeLists.txt:
HARDENED_RUNTIME_ENABLED TRUE
HARDENED_RUNTIME_OPTIONS "com.apple.security.files.user-selected.read-write"
I thought that this would be helpful for anyone experiencing a similar issue - the JUCE documentation's coverage of entitlements is fairly limited, so maybe this is worth adding to Pamplejuce's CMakeLists.txt or the Pamplejuce documentation (if the 'out of the box' philosophy is to be maintained), as these details are abstracted away by the Projucer but not by the CMake API.
Overview
The
juce::FileChooserdoes not open in Logic Pro X, despite working as expected in the Standalone target. This was tested using a minimal example.Steps to reproduce
git submodule update --init --recursiveJUCE_MODAL_LOOPS_PERMITTED=1totarget_compile_definitionsinCMakeLists.txtPluginEditor::inspectButtoncallback with:cmake -B build -G Xcode,open build/Pamplejuce.xcodeproj)Solution
This is an issue with entitlements on MacOS. This can be fixed by adding the following options to the
juce_add_plugin()call inCMakeLists.txt:I thought that this would be helpful for anyone experiencing a similar issue - the JUCE documentation's coverage of entitlements is fairly limited, so maybe this is worth adding to Pamplejuce's
CMakeLists.txtor the Pamplejuce documentation (if the 'out of the box' philosophy is to be maintained), as these details are abstracted away by the Projucer but not by the CMake API.