Browse Source

Implement Plugin::getBundlePath() for VST2

pull/344/head
falkTX 3 years ago
parent
commit
26eb9dd4e4
1 changed files with 27 additions and 0 deletions
  1. +27
    -0
      distrho/src/DistrhoPluginVST2.cpp

+ 27
- 0
distrho/src/DistrhoPluginVST2.cpp View File

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

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

#if DISTRHO_PLUGIN_HAS_UI && ! DISTRHO_PLUGIN_HAS_EMBED_UI
@@ -1680,6 +1681,32 @@ const AEffect* VSTPluginMain(audioMasterCallback audioMaster)
if (audioMaster(nullptr, audioMasterVersion, 0, 0, nullptr, 0.0f) == 0)
return nullptr;

// 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 (tmpPath.endsWith(".vst"))
{
bundlePath = tmpPath;
d_nextBundlePath = bundlePath.buffer();
}
#endif
}

// first internal init
PluginExporter* plugin = nullptr;
vst_dispatcherCallback(nullptr, -1729, 0xdead, 0xf00d, &plugin, 0.0f);


Loading…
Cancel
Save