From 7bcc44459f7c3b76274715565cd659734538921e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 24 May 2012 03:09:06 +0000 Subject: 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 --- src/instance.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') 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; -- cgit v1.2.1