]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add perl dir to the path at runtime on windows.
authorMichael Jerris <mike@jerris.com>
Mon, 6 Mar 2006 03:23:34 +0000 (03:23 +0000)
committerMichael Jerris <mike@jerris.com>
Mon, 6 Mar 2006 03:23:34 +0000 (03:23 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@759 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_apr.h
src/switch_loadable_module.c

index cb978086f5f17a51b4f41e9fe70f0bd02a7c223a..df3f2d31c08250fd1360c844caca623c101d428e 100644 (file)
@@ -64,6 +64,7 @@ extern "C" {
 #define APR_WANT_STDIO
 #define APR_WANT_STRFUNC
 #include <apr_want.h>
+#include <apr_env.h>
 
 /*
    The pieces of apr we allow ppl to pass around between modules we typedef into our namespace and wrap all the functions
index 82d19cfa78cd841c4f41ff1e80028f86c7b8d482..9b37ee35397b4719fcae0164f561cbfa9ff56abf 100644 (file)
@@ -29,7 +29,7 @@
  * switch_loadable_module.c -- Loadable Modules
  *
  */
-#include <switch_console.h>
+#include <switch.h>
 
 
 struct switch_loadable_module {
@@ -310,6 +310,24 @@ static void process_module_file(char *dir, char *fname)
        }
 }
 
+#ifdef WIN32
+static void switch_loadable_module_path_init()
+{
+       char *path =NULL, *working =NULL;
+       apr_dir_t *perl_dir_handle = NULL;
+
+       apr_env_get(&path, "path", loadable_modules.pool);\r
+       apr_filepath_get(&working, APR_FILEPATH_NATIVE , loadable_modules.pool);\r
+
+       if (apr_dir_open(&perl_dir_handle, ".\\perl", loadable_modules.pool) == APR_SUCCESS) {\r
+                       apr_dir_close(perl_dir_handle);\r
+                       apr_env_set("path", \r
+                                               apr_pstrcat(loadable_modules.pool, path, ";", working, "\\perl", NULL), \r
+                                               loadable_modules.pool);\r
+       }\r
+}
+#endif
+
 SWITCH_DECLARE(switch_status) switch_loadable_module_init()
 {
 
@@ -338,6 +356,10 @@ SWITCH_DECLARE(switch_status) switch_loadable_module_init()
        switch_core_new_memory_pool(&loadable_modules.pool);
 
 
+#ifdef WIN32
+       switch_loadable_module_path_init();\r
+#endif
+
        switch_core_hash_init(&loadable_modules.module_hash, loadable_modules.pool);
        switch_core_hash_init(&loadable_modules.endpoint_hash, loadable_modules.pool);
        switch_core_hash_init(&loadable_modules.codec_hash, loadable_modules.pool);