diff --git a/utils/Makefile b/utils/Makefile index 15e0dd66..18409926 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -54,7 +54,7 @@ else JACK_LIBS = $(shell pkg-config --libs jack) endif -LILV_CFLAGS = $(shell pkg-config --cflags lilv-0) +LILV_CFLAGS = $(shell pkg-config --cflags lilv-0) -Wno-parentheses LILV_LIBS = $(shell pkg-config --libs lilv-0) all: build diff --git a/utils/utils_lilv.cpp b/utils/utils_lilv.cpp index e5f77124..cd7e96bc 100644 --- a/utils/utils_lilv.cpp +++ b/utils/utils_lilv.cpp @@ -4582,6 +4582,10 @@ const PedalboardInfo_Mini* const* get_all_pedalboards(const int ptype) if (ptype == kPedalboardInfoFactoryOnly && FACTORYINFO != nullptr) return FACTORYINFO; +#ifndef LILV_OPTION_LV2_PATH + char* const oldlv2path = getenv_strdup_or_null("LV2_PATH"); +#endif + const char* pedalboard_lv2_path; switch (ptype) { @@ -4604,12 +4608,28 @@ const PedalboardInfo_Mini* const* get_all_pedalboards(const int ptype) LilvWorld* const w = lilv_world_new(); +#ifdef LILV_OPTION_LV2_PATH LilvNode* const lv2path = lilv_new_string(w, pedalboard_lv2_path); lilv_world_set_option(w, LILV_OPTION_LV2_PATH, lv2path); lilv_free(lv2path); +#else + setenv("LV2_PATH", pedalboard_lv2_path, 1); +#endif lilv_world_load_all(w); +#ifndef LILV_OPTION_LV2_PATH + if (oldlv2path != nullptr) + { + setenv("LV2_PATH", oldlv2path, 1); + free(oldlv2path); + } + else + { + unsetenv("LV2_PATH"); + } +#endif + LilvNode* const versiontypenode = lilv_new_uri(w, LILV_NS_MODPEDAL "version"); LilvNode* const rdftypenode = lilv_new_uri(w, LILV_NS_RDF "type"); LilvNode* const ingenblocknode = lilv_new_uri(w, LILV_NS_INGEN "block"); @@ -4665,12 +4685,29 @@ const char* const* get_broken_pedalboards(void) { LilvWorld* const w = lilv_world_new(); +#ifdef LILV_OPTION_LV2_PATH LilvNode* const lv2path = lilv_new_string(w, _get_lv2_pedalboards_path()); lilv_world_set_option(w, LILV_OPTION_LV2_PATH, lv2path); lilv_free(lv2path); +#else + char* const oldlv2path = getenv_strdup_or_null("LV2_PATH"); + setenv("LV2_PATH", _get_lv2_pedalboards_path(), 1); +#endif lilv_world_load_all(w); +#ifndef LILV_OPTION_LV2_PATH + if (oldlv2path != nullptr) + { + setenv("LV2_PATH", oldlv2path, 1); + free(oldlv2path); + } + else + { + unsetenv("LV2_PATH"); + } +#endif + LilvNode* const ingenblocknode = lilv_new_uri(w, LILV_NS_INGEN "block"); LilvNode* const lv2protonode = lilv_new_uri(w, LILV_NS_LV2 "prototype"); const LilvPlugins* const plugins = lilv_world_get_all_plugins(w); @@ -5809,11 +5846,19 @@ const StatePortValue* get_state_port_values(const char* const state) LilvWorld* const w = W; + #ifdef _WIN32 putenv("LILV_STATE_SKIP_PROPERTIES=2"); + #else + setenv("LILV_STATE_SKIP_PROPERTIES", "2", 1); + #endif LilvState* const lstate = lilv_state_new_from_string(w, &uridMap, state); + #ifdef _WIN32 putenv("LILV_STATE_SKIP_PROPERTIES="); + #else + unsetenv("LILV_STATE_SKIP_PROPERTIES"); + #endif if (lstate != nullptr) {