From: Jeff Lenk Date: Thu, 7 Apr 2011 20:47:30 +0000 (-0500) Subject: FS-3232 --resolve using relative path in windows script X-Git-Tag: v1.2-rc1~118^2~151 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5310735c5f257c52be63efb1dd12221c4c330460;p=thirdparty%2Ffreeswitch.git FS-3232 --resolve using relative path in windows script --- diff --git a/src/switch_core.c b/src/switch_core.c index 85e795c408..0ee4708a3d 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -480,9 +480,13 @@ SWITCH_DECLARE(void) switch_core_set_globals(void) DWORD dwBufSize = BUFSIZE; char base_dir[1024]; char *lastbacklash; + GetModuleFileName(NULL, base_dir, BUFSIZE); lastbacklash = strrchr(base_dir, '\\'); base_dir[(lastbacklash - base_dir)] = '\0'; + /* set base_dir as cwd, to be able to use relative paths in scripting languages (e.g. mod_lua) when FS is running as a service or while debugging FS using visual studio */ + SetCurrentDirectory(base_dir); + #else char base_dir[1024] = SWITCH_PREFIX_DIR; #endif