make new modules.conf OS independant

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@613 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2006-02-14 17:31:20 +00:00
parent 77bf3ceb5d
commit 5d8283c4ad
2 changed files with 39 additions and 22 deletions

View File

@ -3,39 +3,42 @@
; If this option is the first one the rest of them will be ignored
;load => all
; Extension will be chosen automaticly if not specified (.dll for windows, .so for UNIX)
; Full paths will be taken "as is" (eg /some/dir/mymod.so)
; Event Handlers
load => mod_zeroconf.so
load => mod_xmpp_event.so
load => mod_zeroconf
load => mod_xmpp_event
; Directory Interfaces
load => mod_ldap.so
load => mod_ldap
; Endpoints
load => mod_exosip.so
load => mod_iax.so
load => mod_woomera.so
load => mod_exosip
load => mod_iax
load => mod_woomera
; Applications
load => mod_bridgecall.so
load => mod_ivrtest.so
load => mod_playback.so
load => mod_bridgecall
load => mod_ivrtest
load => mod_playback
; Dialplan Interfaces
load => mod_dialplan_demo.so
load => mod_dialplan_directory.so
load => mod_pcre.so
load => mod_dialplan_demo
load => mod_dialplan_directory
load => mod_pcre
; Codec Interfaces
load => mod_g711.so
load => mod_gsm.so
load => mod_l16.so
load => mod_speex.so
load => mod_g711
load => mod_gsm
load => mod_l16
load => mod_speex
; File Format Interfaces
load => mod_sndfile.so
load => mod_sndfile
; Timers
load => mod_softtimer.so
load => mod_softtimer

View File

@ -194,6 +194,13 @@ static void process_module_file(char *dir, char *fname)
char *file;
switch_loadable_module *new_module = NULL;
#ifdef WIN32
const char *ext = ".dll";
#else
const char *ext = ".so";
#endif
if (!(file = switch_core_strdup(loadable_modules.pool, fname))) {
return;
}
@ -201,9 +208,15 @@ static void process_module_file(char *dir, char *fname)
if (*file == '/') {
path = switch_core_strdup(loadable_modules.pool, file);
} else {
len = strlen(dir) + strlen(file) + 3;
path = (char *) switch_core_alloc(loadable_modules.pool, len);
snprintf(path, len, "%s/%s", dir, file);
if (strchr(file, '.')) {
len = strlen(dir) + strlen(file) + 3;
path = (char *) switch_core_alloc(loadable_modules.pool, len);
snprintf(path, len, "%s/%s", dir, file);
} else {
len = strlen(dir) + strlen(file) + 7;
path = (char *) switch_core_alloc(loadable_modules.pool, len);
snprintf(path, len, "%s/%s%s", dir, file, ext);
}
}
if (switch_loadable_module_load_file(path, loadable_modules.pool, &new_module) == SWITCH_STATUS_SUCCESS) {
@ -354,7 +367,8 @@ SWITCH_DECLARE(switch_status) switch_loadable_module_init()
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "This option must be the first one to work.");
}
} else {
if (!strstr(val, ext) && !strstr(val, EXT)) {
if (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT)) {
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Invalid extension for %s\n", val);
continue;
}
process_module_file((char *) SWITCH_MOD_DIR, (char *) val);