From e9f41ad9979d35d7f747ec25652e5ff25da8e853 Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 31 Jan 2022 19:32:56 +0000 Subject: [PATCH] Fix lv2 ttl generation for static builds Signed-off-by: falkTX --- distrho/src/DistrhoPluginLV2export.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/distrho/src/DistrhoPluginLV2export.cpp b/distrho/src/DistrhoPluginLV2export.cpp index a857140c..202b6335 100644 --- a/distrho/src/DistrhoPluginLV2export.cpp +++ b/distrho/src/DistrhoPluginLV2export.cpp @@ -42,6 +42,10 @@ # include "mod-license.h" #endif +#ifndef DISTRHO_OS_WINDOWS +# include +#endif + #include #include @@ -225,7 +229,17 @@ void lv2_generate_ttl(const char* const basename) USE_NAMESPACE_DISTRHO String bundlePath(getBinaryFilename()); - bundlePath.truncate(bundlePath.rfind(DISTRHO_OS_SEP)); + if (bundlePath.isNotEmpty()) + { + bundlePath.truncate(bundlePath.rfind(DISTRHO_OS_SEP)); + } +#ifndef DISTRHO_OS_WINDOWS + else if (char* const cwd = ::getcwd(nullptr, 0)) + { + bundlePath = cwd; + std::free(cwd); + } +#endif d_nextBundlePath = bundlePath.buffer(); // Dummy plugin to get data from