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 /src | |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/instance.c | 9 |
1 files changed, 6 insertions, 3 deletions
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; |