Skip to content

juce::FileChooser opening in Standalone but not Logic Pro #134

@alecapple

Description

@alecapple

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

  1. Clone the Pamplejuce repository
  2. Initialize submodules with git submodule update --init --recursive
  3. Add JUCE_MODAL_LOOPS_PERMITTED=1 to target_compile_definitions in CMakeLists.txt
  4. 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");
        }
    };
  1. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions