diff options
author | David Robillard <d@drobilla.net> | 2012-05-24 03:09:06 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-05-24 03:09:06 +0000 |
commit | 7bcc44459f7c3b76274715565cd659734538921e (patch) | |
tree | 5374afbb3f35221aaad9206ef5ed8777114e5064 | |
parent | 6116836c45952d4ae67585031b5fbc704106b2b0 (diff) | |
download | suil-7bcc44459f7c3b76274715565cd659734538921e.tar.gz suil-7bcc44459f7c3b76274715565cd659734538921e.tar.bz2 suil-7bcc44459f7c3b76274715565cd659734538921e.zip |
Allow run-time configuation of module directory via environment variable SUIL_MODULE_DIR.
git-svn-id: http://svn.drobilla.net/lad/trunk/suil@4457 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | src/instance.c | 9 | ||||
-rw-r--r-- | suil/suil.h | 6 |
3 files changed, 14 insertions, 3 deletions
@@ -3,6 +3,8 @@ suil (9999) stable; * Fix crashes when wrapper widget is destroyed by toolkit before suil cleanup function is called * Link Gtk wrappers with 'nodelete' to avoid Glib type errors + * Allow run-time configuation of module directory via environment variable + SUIL_MODULE_DIR -- David Robillard <d@drobilla.net> diff --git a/src/instance.c b/src/instance.c index e8af856..2f68692 100644 --- a/src/instance.c +++ b/src/instance.c @@ -85,14 +85,17 @@ open_wrapper(SuilHost* host, return NULL; } - const size_t path_len = strlen(SUIL_MODULE_DIR) + const char* const env_dir = getenv("SUIL_MODULE_DIR"); + const char* const mod_dir = env_dir ? env_dir : SUIL_MODULE_DIR; + + const size_t path_len = strlen(mod_dir) + strlen(module_name) + strlen(SUIL_MODULE_EXT) + 2; char* const path = calloc(path_len, 1); snprintf(path, path_len, "%s%s%s%s", - SUIL_MODULE_DIR, SUIL_DIR_SEP, module_name, SUIL_MODULE_EXT); + mod_dir, SUIL_DIR_SEP, module_name, SUIL_MODULE_EXT); // Open wrap module dlerror(); @@ -181,7 +184,7 @@ suil_instance_new(SuilHost* host, dlclose(lib); return NULL; } - + instance->lib_handle = lib; instance->descriptor = descriptor; diff --git a/suil/suil.h b/suil/suil.h index 3c3ce19..1ffafcc 100644 --- a/suil/suil.h +++ b/suil/suil.h @@ -158,6 +158,12 @@ suil_ui_supported(const char* host_type_uri, /** Instantiate a UI for an LV2 plugin. + + This funcion may load a suil module to adapt the UI to the desired toolkit. + Suil is configured at compile time to load modules from the appropriate + place, but this can be changed at run-time via the environment variable + SUIL_MODULE_DIR. This makes it possible to bundle suil with an application. + @param host Host descriptor. @param controller Opaque host controller pointer. @param container_type_uri URI of the desired host container widget type. |