]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
make new modules.conf OS independant
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 14 Feb 2006 17:31:20 +0000 (17:31 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 14 Feb 2006 17:31:20 +0000 (17:31 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@613 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/modules.conf
src/switch_loadable_module.c

index d9fd14eb614a84fd25ce48a12ebf0155268035cc..fb67358a638deeb23af9122e2a2eb1af7ef0a88a 100644 (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
 
 
 
index a584a51d534a2b4cb992adca87eccba56ee470b6..d4a1448ea7c13af84d778f250f82d8500327a55c 100644 (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);