Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
alecapple opened this issue Jan 20, 2025 · 2 comments
Open

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

alecapple opened this issue Jan 20, 2025 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@alecapple
Copy link

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.

@alecapple
Copy link
Author

After doing some additional research, I've learned about the additional requirements of AUv3 vs. AUv2 in terms of sandboxing - it might be a good idea to make AUv2 the default (disable AUv3 target initially) so that users aren't surprised by the many potential issues that might arise from trying to get AUv3 working.

@sudara
Copy link
Owner

sudara commented Jan 21, 2025

Appreciate all the detail here — thanks!

Yeah, actually that's a good point, I've got AUv3 in there with no actual support for it. Removing is a good idea for now.

JUCE_MODAL_LOOPS_PERMITTED=1 is essentially deprecated (I still use it in tests) and I don't personally use the file chooser, but I think a good solution here would be to add it to the documentation, as it's probably needed often.

@sudara sudara added the documentation Improvements or additions to documentation label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants