Browse Source

Remove plugins from macOS quarentine before running them

tags/v2.3.0-RC1
falkTX 3 years ago
parent
commit
532925a608
7 changed files with 61 additions and 0 deletions
  1. +8
    -0
      source/backend/engine/CarlaEngine.cpp
  2. +2
    -0
      source/backend/plugin/CarlaPluginJuce.cpp
  3. +14
    -0
      source/backend/plugin/CarlaPluginLV2.cpp
  4. +9
    -0
      source/bridges-ui/CarlaBridgeFormatLV2.cpp
  5. +16
    -0
      source/discovery/carla-discovery.cpp
  6. +7
    -0
      source/utils/CarlaMacUtils.cpp
  7. +5
    -0
      source/utils/CarlaMacUtils.hpp

+ 8
- 0
source/backend/engine/CarlaEngine.cpp View File

@@ -565,6 +565,8 @@ bool CarlaEngine::addPlugin(const BinaryType btype,
} }


const bool canBeBridged = ptype != PLUGIN_INTERNAL const bool canBeBridged = ptype != PLUGIN_INTERNAL
&& ptype != PLUGIN_DLS
&& ptype != PLUGIN_GIG
&& ptype != PLUGIN_SF2 && ptype != PLUGIN_SF2
&& ptype != PLUGIN_SFZ && ptype != PLUGIN_SFZ
&& ptype != PLUGIN_JACK; && ptype != PLUGIN_JACK;
@@ -573,6 +575,12 @@ bool CarlaEngine::addPlugin(const BinaryType btype,
bool preferBridges = pData->options.preferPluginBridges; bool preferBridges = pData->options.preferPluginBridges;
const char* needsArchBridge = nullptr; const char* needsArchBridge = nullptr;


#ifdef CARLA_OS_MAC
// Plugin might be in quarentine due to Apple stupid notarization rules, let's remove that if possible
if (canBeBridged && ptype != PLUGIN_LV2 && ptype != PLUGIN_AU)
removeFileFromQuarantine(filename);
#endif

#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (canBeBridged && ! preferBridges) if (canBeBridged && ! preferBridges)
{ {


+ 2
- 0
source/backend/plugin/CarlaPluginJuce.cpp View File

@@ -1411,6 +1411,8 @@ public:
for (int i = 0; i < fFormatManager.getNumFormats(); ++i) for (int i = 0; i < fFormatManager.getNumFormats(); ++i)
{ {
juce::AudioPluginFormat* const format = fFormatManager.getFormat(i); juce::AudioPluginFormat* const format = fFormatManager.getFormat(i);
CARLA_SAFE_ASSERT_CONTINUE(format != nullptr);

carla_debug("Trying to load '%s' plugin with format '%s'", fileOrIdentifier.toRawUTF8(), format->getName().toRawUTF8()); carla_debug("Trying to load '%s' plugin with format '%s'", fileOrIdentifier.toRawUTF8(), format->getName().toRawUTF8());


try { try {


+ 14
- 0
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -41,6 +41,10 @@ extern "C" {
#include "water/files/File.h" #include "water/files/File.h"
#include "water/misc/Time.h" #include "water/misc/Time.h"


#ifdef CARLA_OS_MAC
# include "CarlaMacUtils.hpp"
#endif

#include <string> #include <string>
#include <vector> #include <vector>


@@ -6296,6 +6300,11 @@ public:
// --------------------------------------------------------------- // ---------------------------------------------------------------
// open DLL // open DLL


#ifdef CARLA_OS_MAC
// Binary might be in quarentine due to Apple stupid notarization rules, let's remove that if possible
removeFileFromQuarantine(fRdfDescriptor->Binary);
#endif

if (! pData->libOpen(fRdfDescriptor->Binary)) if (! pData->libOpen(fRdfDescriptor->Binary))
{ {
pData->engine->setLastError(pData->libError(fRdfDescriptor->Binary)); pData->engine->setLastError(pData->libError(fRdfDescriptor->Binary));
@@ -6961,6 +6970,11 @@ public:
// --------------------------------------------------------------- // ---------------------------------------------------------------
// open UI DLL // open UI DLL


#ifdef CARLA_OS_MAC
// Binary might be in quarentine due to Apple stupid notarization rules, let's remove that if possible
removeFileFromQuarantine(fUI.rdfDescriptor->Binary);
#endif

if (! pData->uiLibOpen(fUI.rdfDescriptor->Binary, canDelete)) if (! pData->uiLibOpen(fUI.rdfDescriptor->Binary, canDelete))
{ {
carla_stderr2("Could not load UI library, error was:\n%s", pData->libError(fUI.rdfDescriptor->Binary)); carla_stderr2("Could not load UI library, error was:\n%s", pData->libError(fUI.rdfDescriptor->Binary));


+ 9
- 0
source/bridges-ui/CarlaBridgeFormatLV2.cpp View File

@@ -25,6 +25,10 @@


#include "water/files/File.h" #include "water/files/File.h"


#ifdef CARLA_OS_MAC
# include "CarlaMacUtils.hpp"
#endif

#include <string> #include <string>
#include <vector> #include <vector>


@@ -512,6 +516,11 @@ public:
// ------------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------------
// open DLL // open DLL


#ifdef CARLA_OS_MAC
// Binary might be in quarentine due to Apple stupid notarization rules, let's remove that if possible
CarlaBackend::removeFileFromQuarantine(fRdfUiDescriptor->Binary);
#endif

if (! libOpen(fRdfUiDescriptor->Binary)) if (! libOpen(fRdfUiDescriptor->Binary))
{ {
carla_stderr("Failed to load UI binary, error was:\n%s", libError()); carla_stderr("Failed to load UI binary, error was:\n%s", libError());


+ 16
- 0
source/discovery/carla-discovery.cpp View File

@@ -63,6 +63,7 @@
# undef Component # undef Component
# undef MemoryBlock # undef MemoryBlock
# undef Point # undef Point
# include "CarlaMacUtils.cpp"
#endif #endif


#ifdef CARLA_OS_WIN #ifdef CARLA_OS_WIN
@@ -1753,6 +1754,21 @@ int main(int argc, char* argv[])
} }
#endif #endif


#ifdef CARLA_OS_MAC
// Plugin might be in quarentine due to Apple stupid notarization rules, let's remove that if possible
switch (type)
{
case PLUGIN_LADSPA:
case PLUGIN_DSSI:
case PLUGIN_VST2:
case PLUGIN_VST3:
removeFileFromQuarantine(filename);
break;
default:
break;
}
#endif

switch (type) switch (type)
{ {
case PLUGIN_LADSPA: case PLUGIN_LADSPA:


+ 7
- 0
source/utils/CarlaMacUtils.cpp View File

@@ -20,6 +20,8 @@
#include "CarlaMacUtils.hpp" #include "CarlaMacUtils.hpp"
#include "CarlaString.hpp" #include "CarlaString.hpp"


#include <sys/xattr.h>

#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>


CARLA_BACKEND_START_NAMESPACE CARLA_BACKEND_START_NAMESPACE
@@ -54,6 +56,11 @@ const char* findBinaryInBundle(const char* const bundleDir)
return ret.buffer(); return ret.buffer();
} }


bool removeFileFromQuarantine(const char* const filename)
{
return removexattr(filename, "com.apple.quarantine", 0) == 0;
}

// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------


AutoNSAutoreleasePool::AutoNSAutoreleasePool() AutoNSAutoreleasePool::AutoNSAutoreleasePool()


+ 5
- 0
source/utils/CarlaMacUtils.hpp View File

@@ -33,6 +33,11 @@ CARLA_BACKEND_START_NAMESPACE
*/ */
const char* findBinaryInBundle(const char* const bundleDir); const char* findBinaryInBundle(const char* const bundleDir);


/*
* ...
*/
bool removeFileFromQuarantine(const char* const filename);

/* /*
* ... * ...
*/ */


Loading…
Cancel
Save