FigBug / Gin

A few extras for juce
BSD 3-Clause "New" or "Revised" License
262 stars 40 forks source link

layout doesn't work on macos when app sandbox is enabled #41

Closed modosc closed 1 year ago

modosc commented 1 year ago

this code won't work on macos if app sandbox is enabled. specifically only a single element is rendered:

image

i ended up getting it to work with this horribleness:

void Editor::resized() {
#if JUCE_DEBUG
#if JUCE_MAC
  if (juce::SystemStats::isAppSandboxEnabled()) {
    DBG("disabling layout reloading because AppSandbox is enabled");
    layout.setLayout("layout.json");
  } else {
    auto f = juce::File(__FILE__).getChildFile("../../Resources/layout.json");
    layout.setLayout("layout.json", f);
  }
#else
  auto f = juce::File(__FILE__).getChildFile("../../Resources/layout.json");
  layout.setLayout("layout.json", f);
#endif
#else
  layout.setLayout("layout.json");
#endif
}

i'm not suggesting you do this in the demos but maybe a comment about AppSandbox compatibility would help the next person who hits this?

FigBug commented 1 year ago

Fixed in 42147be1dcb40a6c0b5b6fa719d1ac933ea3b36f