Fix LV2 UIs with spacey paths (e.g. Pianoteq).
authorDavid Robillard <d@drobilla.net>
Sat, 14 Feb 2015 02:59:11 +0000 (21:59 -0500)
committerDavid Robillard <d@drobilla.net>
Sat, 14 Feb 2015 03:00:38 +0000 (22:00 -0500)
gtk2_ardour/lv2_plugin_ui.cc
libs/ardour/wscript

index c732aca56772644cfe89dc2821a9150957fdb126..8a6d5260b496f33274e4ba2fc6f58b8f3d86f8d7 100644 (file)
@@ -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);
index f1167e8611cb065eeb74fe066522d443a56aca32..474ffdc6c1d0b4e573ae1d1c40f6d78e729ce4f8 100644 (file)
@@ -276,6 +276,8 @@ def configure(conf):
                           atleast_version='0.16.0', mandatory=False)
         autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV_0_19_2',
                           atleast_version='0.19.2', mandatory=False)
+        autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV_0_21_1',
+                          atleast_version='0.21.1', mandatory=False)
         autowaf.check_pkg(conf, 'suil-0', uselib_store='SUIL',
                           atleast_version='0.6.0', mandatory=False)
         conf.define ('LV2_SUPPORT', 1)