From 5b3ff655f1f8b2518b21110a5e15f3bef832f381 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 13 Feb 2015 21:59:11 -0500 Subject: Fix LV2 UIs with spacey paths (e.g. Pianoteq). --- gtk2_ardour/lv2_plugin_ui.cc | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'gtk2_ardour/lv2_plugin_ui.cc') diff --git a/gtk2_ardour/lv2_plugin_ui.cc b/gtk2_ardour/lv2_plugin_ui.cc index c732aca567..8a6d5260b4 100644 --- a/gtk2_ardour/lv2_plugin_ui.cc +++ b/gtk2_ardour/lv2_plugin_ui.cc @@ -282,7 +282,21 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title) _lv2->enable_ui_emission(); } - const LilvUI* ui = (const LilvUI*)_lv2->c_ui(); + const LilvUI* ui = (const LilvUI*)_lv2->c_ui(); + const LilvNode* bundle = lilv_ui_get_bundle_uri(ui); + const LilvNode* binary = lilv_ui_get_binary_uri(ui); +#ifdef HAVE_LILV_0_21_1 + char* ui_bundle_path = lilv_file_uri_parse(lilv_node_as_uri(bundle), NULL); + char* ui_binary_path = lilv_file_uri_parse(lilv_node_as_uri(binary), NULL); +#else + char* ui_bundle_path = strdup(lilv_uri_to_path(lilv_node_as_uri(bundle))); + char* ui_binary_path = strdup(lilv_uri_to_path(lilv_node_as_uri(binary))); +#endif + if (!ui_bundle_path || !ui_binary_path) { + error << _("failed to get path for UI bindle or binary") << endmsg; + return; + } + _inst = suil_instance_new( ui_host, this, @@ -290,10 +304,12 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title) _lv2->uri(), lilv_node_as_uri(lilv_ui_get_uri(ui)), lilv_node_as_uri((const LilvNode*)_lv2->c_ui_type()), - lilv_uri_to_path(lilv_node_as_uri(lilv_ui_get_bundle_uri(ui))), - lilv_uri_to_path(lilv_node_as_uri(lilv_ui_get_binary_uri(ui))), + ui_bundle_path, + ui_binary_path, features); + free(ui_bundle_path); + free(ui_binary_path); free(features); #define GET_WIDGET(inst) suil_instance_get_widget((SuilInstance*)inst); -- cgit v1.2.3