From 242e93e41ea43e6bc6336ec720033798b29e33bb Mon Sep 17 00:00:00 2001 From: reuk Date: Thu, 29 Jun 2023 12:29:17 +0100 Subject: [PATCH] LV2 Host: Avoid removing anchors from plugin URIs when loading editors --- .../format_types/juce_LV2PluginFormat.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/modules/juce_audio_processors/format_types/juce_LV2PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_LV2PluginFormat.cpp index 78eb016c14..b4f358812e 100644 --- a/modules/juce_audio_processors/format_types/juce_LV2PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_LV2PluginFormat.cpp @@ -2579,15 +2579,8 @@ public: File bundlePath; URL pluginUri; - auto withBundlePath (File v) const noexcept { return with (&UiInstanceArgs::bundlePath, std::move (v)); } - auto withPluginUri (URL v) const noexcept { return with (&UiInstanceArgs::pluginUri, std::move (v)); } - -private: - template - UiInstanceArgs with (Member UiInstanceArgs::* member, Member value) const noexcept - { - return juce::lv2_host::with (*this, member, std::move (value)); - } + auto withBundlePath (File v) const noexcept { return withMember (*this, &UiInstanceArgs::bundlePath, std::move (v)); } + auto withPluginUri (URL v) const noexcept { return withMember (*this, &UiInstanceArgs::pluginUri, std::move (v)); } }; static File bundlePathFromUri (const char* uri) @@ -2614,7 +2607,7 @@ public: mLV2_UI__floatProtocol (map.map (LV2_UI__floatProtocol)), mLV2_ATOM__atomTransfer (map.map (LV2_ATOM__atomTransfer)), mLV2_ATOM__eventTransfer (map.map (LV2_ATOM__eventTransfer)), - instance (makeInstance (args.pluginUri, args.bundlePath, features)), + instance (makeInstance (args, features)), idleCallback (getExtensionData (world, LV2_UI__idleInterface)) { jassert (descriptor != nullptr); @@ -2682,14 +2675,14 @@ private: using Instance = std::unique_ptr; using Idle = int (*) (LV2UI_Handle); - Instance makeInstance (const URL& pluginUri, const File& bundlePath, const LV2_Feature* const* features) + Instance makeInstance (const UiInstanceArgs& args, const LV2_Feature* const* features) { if (descriptor->get() == nullptr) return { nullptr, [] (LV2UI_Handle) {} }; return Instance { descriptor->get()->instantiate (descriptor->get(), - pluginUri.toString (false).toRawUTF8(), - File::addTrailingSeparator (bundlePath.getFullPathName()).toRawUTF8(), + args.pluginUri.toString (true).toRawUTF8(), + File::addTrailingSeparator (args.bundlePath.getFullPathName()).toRawUTF8(), writeFunction, this, &widget,