From 1a75821df8477cb3a7d959034f3d550076ffcbca Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Thu, 9 Sep 2010 23:25:35 -0400 Subject: [PATCH] switch_loadable_module: Add attribute "path" to autoload_configs/modules.conf.xml entry. Useful for module made outside of fs source tree like mod_com_g729. When you delete your lib bin mod folder after a clean install, you don't have to remember to recopy mod_com_g729 if located in mod_com folder. --- src/switch_loadable_module.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 67325648b2..bf636dd4c2 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1277,6 +1277,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init() for (ld = switch_xml_child(mods, "load"); ld; ld = ld->next) { switch_bool_t global = SWITCH_FALSE; const char *val = switch_xml_attr_soft(ld, "module"); + const char *path = switch_xml_attr_soft(ld, "path"); const char *critical = switch_xml_attr_soft(ld, "critical"); const char *sglobal = switch_xml_attr_soft(ld, "global"); if (zstr(val) || (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT))) { @@ -1285,7 +1286,10 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init() } global = switch_true(sglobal); - if (switch_loadable_module_load_module_ex((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) val, SWITCH_FALSE, global, &err) == SWITCH_STATUS_FALSE) { + if (path && zstr(path)) { + path = SWITCH_GLOBAL_dirs.mod_dir; + } + if (switch_loadable_module_load_module_ex((char *) path, (char *) val, SWITCH_FALSE, global, &err) == SWITCH_STATUS_FALSE) { if (critical && switch_true(critical)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to load critical module '%s', abort()\n", val); abort(); @@ -1307,13 +1311,18 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init() for (ld = switch_xml_child(mods, "load"); ld; ld = ld->next) { switch_bool_t global = SWITCH_FALSE; const char *val = switch_xml_attr_soft(ld, "module"); + const char *path = switch_xml_attr_soft(ld, "path"); const char *sglobal = switch_xml_attr_soft(ld, "global"); if (zstr(val) || (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Invalid extension for %s\n", val); continue; } global = switch_true(sglobal); - switch_loadable_module_load_module_ex((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) val, SWITCH_FALSE, global, &err); + + if (path && zstr(path)) { + path = SWITCH_GLOBAL_dirs.mod_dir; + } + switch_loadable_module_load_module_ex((char *) path, (char *) val, SWITCH_FALSE, global, &err); count++; } }