commit 26eb9dd4e461d311f021ac26237d176e2cfb14dc
parent 2c910526192f959e8156a8a4d31298e48f2e7ed4
Author: falkTX <falktx@falktx.com>
Date: Thu, 21 Oct 2021 02:29:07 +0100
Implement Plugin::getBundlePath() for VST2
Diffstat:
1 file changed, 27 insertions(+), 0 deletions(-)
diff --git a/distrho/src/DistrhoPluginVST2.cpp b/distrho/src/DistrhoPluginVST2.cpp
@@ -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);