summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-05-24 03:09:06 +0000
committerDavid Robillard <d@drobilla.net>2012-05-24 03:09:06 +0000
commit7bcc44459f7c3b76274715565cd659734538921e (patch)
tree5374afbb3f35221aaad9206ef5ed8777114e5064
parent6116836c45952d4ae67585031b5fbc704106b2b0 (diff)
downloadsuil-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--NEWS2
-rw-r--r--src/instance.c9
-rw-r--r--suil/suil.h6
3 files changed, 14 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index fc73aad..69d9dd3 100644
--- a/NEWS
+++ b/NEWS
@@ -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.