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
This commit is contained in:
Michael Jerris 2006-03-06 03:23:34 +00:00
parent 818991e5de
commit 3a0038330d
2 changed files with 24 additions and 1 deletions

View File

@ -64,6 +64,7 @@ extern "C" {
#define APR_WANT_STDIO #define APR_WANT_STDIO
#define APR_WANT_STRFUNC #define APR_WANT_STRFUNC
#include <apr_want.h> #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 The pieces of apr we allow ppl to pass around between modules we typedef into our namespace and wrap all the functions

View File

@ -29,7 +29,7 @@
* switch_loadable_module.c -- Loadable Modules * switch_loadable_module.c -- Loadable Modules
* *
*/ */
#include <switch_console.h> #include <switch.h>
struct switch_loadable_module { 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() 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); 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.module_hash, loadable_modules.pool);
switch_core_hash_init(&loadable_modules.endpoint_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); switch_core_hash_init(&loadable_modules.codec_hash, loadable_modules.pool);