Browse Source

Allow JACK/Standalone to have resources/bundle path too

Signed-off-by: falkTX <falktx@falktx.com>
pull/357/head
falkTX 3 years ago
parent
commit
09ad9bb570
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 51 additions and 21 deletions
  1. +30
    -0
      distrho/src/DistrhoPluginJACK.cpp
  2. +21
    -21
      distrho/src/DistrhoUtils.cpp

+ 30
- 0
distrho/src/DistrhoPluginJACK.cpp View File

@@ -15,6 +15,7 @@
*/ */


#include "DistrhoPluginInternal.hpp" #include "DistrhoPluginInternal.hpp"
#include "../DistrhoPluginUtils.hpp"


#if DISTRHO_PLUGIN_HAS_UI #if DISTRHO_PLUGIN_HAS_UI
# include "DistrhoUIInternal.hpp" # include "DistrhoUIInternal.hpp"
@@ -32,6 +33,7 @@


#ifndef DISTRHO_OS_WINDOWS #ifndef DISTRHO_OS_WINDOWS
# include <signal.h> # include <signal.h>
# include <unistd.h>
#endif #endif


#ifndef JACK_METADATA_ORDER #ifndef JACK_METADATA_ORDER
@@ -949,6 +951,34 @@ int main(int argc, char* argv[])
d_nextSampleRate = jackbridge_get_sample_rate(client); d_nextSampleRate = jackbridge_get_sample_rate(client);
d_nextCanRequestParameterValueChanges = true; d_nextCanRequestParameterValueChanges = true;


#ifndef DISTRHO_OS_WINDOWS
// find plugin bundle
static String bundlePath;
if (bundlePath.isEmpty())
{
String tmpPath(getBinaryFilename());
tmpPath.truncate(tmpPath.rfind(DISTRHO_OS_SEP));
#ifdef DISTRHO_OS_MAC
if (tmpPath.endsWith("/MacOS"))
{
tmpPath.truncate(tmpPath.rfind('/'));
if (tmpPath.endsWith("/Contents"))
{
tmpPath.truncate(tmpPath.rfind('/'));
bundlePath = tmpPath;
d_nextBundlePath = bundlePath.buffer();
}
}
#else
if (access(tmpPath + DISTRHO_OS_SEP_STR "resources", F_OK) == 0)
{
bundlePath = tmpPath;
d_nextBundlePath = bundlePath.buffer();
}
#endif
}
#endif

const PluginJack p(client); const PluginJack p(client);


return 0; return 0;


+ 21
- 21
distrho/src/DistrhoUtils.cpp View File

@@ -94,40 +94,40 @@ const char* getResourcePath(const char* const bundlePath) noexcept
{ {
DISTRHO_SAFE_ASSERT_RETURN(bundlePath != nullptr, nullptr); DISTRHO_SAFE_ASSERT_RETURN(bundlePath != nullptr, nullptr);


#if defined(DISTRHO_PLUGIN_TARGET_LV2)
static String bundlePathLV2;
#if defined(DISTRHO_PLUGIN_TARGET_JACK) || defined(DISTRHO_PLUGIN_TARGET_VST2)
static String resourcePath;


if (bundlePathLV2.isEmpty())
if (resourcePath.isEmpty())
{ {
bundlePathLV2 = bundlePath;
bundlePathLV2 += DISTRHO_OS_SEP_STR "resources";
resourcePath = bundlePath;
# ifdef DISTRHO_OS_MAC
resourcePath += "/Contents/Resources";
# else
resourcePath += DISTRHO_OS_SEP_STR "resources";
# endif
} }


return bundlePathLV2.buffer();
#elif defined(DISTRHO_PLUGIN_TARGET_VST2)
static String bundlePathVST2;
return resourcePath.buffer();
#elif defined(DISTRHO_PLUGIN_TARGET_LV2)
static String resourcePath;


if (bundlePathVST2.isEmpty())
if (resourcePath.isEmpty())
{ {
bundlePathVST2 = bundlePath;
# ifdef DISTRHO_OS_MAC
bundlePathVST2 += "/Contents/Resources";
# else
bundlePathVST2 += DISTRHO_OS_SEP_STR "resources";
# endif
resourcePath = bundlePath;
resourcePath += DISTRHO_OS_SEP_STR "resources";
} }


return bundlePathVST2.buffer();
return resourcePath.buffer();
#elif defined(DISTRHO_PLUGIN_TARGET_VST3) #elif defined(DISTRHO_PLUGIN_TARGET_VST3)
static String bundlePathVST3;
static String resourcePath;


if (bundlePathVST3.isEmpty())
if (resourcePath.isEmpty())
{ {
bundlePathVST3 = bundlePath;
bundlePathVST3 += "/Contents/Resources";
resourcePath = bundlePath;
resourcePath += "/Contents/Resources";
} }


return bundlePathVST3.buffer();
return resourcePath.buffer();
#endif #endif


return nullptr; return nullptr;


Loading…
Cancel
Save