zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit 9d8501476a4a777010604e1dcac1474afcef0a21
parent 3e617fed5acf43e2ac85e936e1e8dd17cca47faf
Author: Robin Gareus <robin@gareus.org>
Date:   Fri,  5 Jan 2018 01:43:07 +0100

Add OSX/macOS plugin bundle paths for banks

Diffstat:
Msrc/Misc/Bank.cpp | 28++++++++++++++++++++++++++++
1 file changed, 28 insertions(+), 0 deletions(-)

diff --git a/src/Misc/Bank.cpp b/src/Misc/Bank.cpp @@ -34,6 +34,18 @@ #include <windows.h> #endif +#ifdef __APPLE__ +#include <dlfcn.h> + +static char* my_dylib_path () { + static Dl_info info; + if (dladdr((const void*) &my_dylib_path, &info)) { + return info.dli_fname; + } + return NULL; +} +#endif + using namespace std; namespace zyn { @@ -377,6 +389,22 @@ void Bank::rescanforbanks() } } #endif +#ifdef __APPLE__ + { + char* path = my_dylib_path (); + if (path && strstr(path, "ZynAddSubFX.dylib") && strlen (path) < 1000) { + char tmp[1024]; + strcpy (tmp, path); + strstr (tmp, "ZynAddSubFX.dylib")[0] = 0; // LV2 + strcat (tmp, "banks"); + scanrootdir(tmp); + strcpy (tmp, path); + strstr (tmp, "ZynAddSubFX.dylib")[0] = 0; + strcat (tmp, "../Resources/banks"); // VST + scanrootdir(tmp); + } + } +#endif //sort the banks sort(banks.begin(), banks.end());