From 3a0038330df46b1fee42f69f313ead9b6b5983fc Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 6 Mar 2006 03:23:34 +0000 Subject: [PATCH] add perl dir to the path at runtime on windows. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@759 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/include/switch_apr.h | 1 + src/switch_loadable_module.c | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/include/switch_apr.h b/src/include/switch_apr.h index cb978086f5..df3f2d31c0 100644 --- a/src/include/switch_apr.h +++ b/src/include/switch_apr.h @@ -64,6 +64,7 @@ extern "C" { #define APR_WANT_STDIO #define APR_WANT_STRFUNC #include +#include /* The pieces of apr we allow ppl to pass around between modules we typedef into our namespace and wrap all the functions diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 82d19cfa78..9b37ee3539 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -29,7 +29,7 @@ * switch_loadable_module.c -- Loadable Modules * */ -#include +#include 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); + apr_filepath_get(&working, APR_FILEPATH_NATIVE , loadable_modules.pool); + + if (apr_dir_open(&perl_dir_handle, ".\\perl", loadable_modules.pool) == APR_SUCCESS) { + apr_dir_close(perl_dir_handle); + apr_env_set("path", + apr_pstrcat(loadable_modules.pool, path, ";", working, "\\perl", NULL), + loadable_modules.pool); + } +} +#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(); +#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);