Mercurial > mplayer.hg
diff get_path.c @ 16781:6809ca5dd307
allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
author | faust3 |
---|---|
date | Sun, 16 Oct 2005 19:14:09 +0000 |
parents | 4be161b8e0ef |
children | 9d4becb83656 |
line wrap: on
line diff
--- a/get_path.c Sun Oct 16 17:44:58 2005 +0000 +++ b/get_path.c Sun Oct 16 19:14:09 2005 +0000 @@ -104,3 +104,41 @@ mp_msg(MSGT_GLOBAL,MSGL_V,"get_path('%s') -> '%s'\n",filename,buff); return buff; } + +#if defined(WIN32) && defined(USE_WIN32DLL) +void set_path_env() +{ + /*make our codec dirs available for LoadLibraryA()*/ + char tmppath[MAX_PATH*2 + 1]; + char win32path[MAX_PATH]; + char realpath[MAX_PATH]; +#ifdef __CYGWIN__ + cygwin_conv_to_full_win32_path(WIN32_PATH,win32path); + strcpy(tmppath,win32path); +#ifdef USE_REALCODECS + cygwin_conv_to_full_win32_path(REALCODEC_PATH,realpath); + sprintf(tmppath,"%s;%s",win32path,realpath); +#endif /*USE_REALCODECS*/ +#else /*__CYGWIN__*/ + /* Expand to absolute path unless it's already absolute */ + if(!strstr(WIN32_PATH,":") && WIN32_PATH[0] != '\\'){ + GetModuleFileNameA(NULL, win32path, MAX_PATH); + strcpy(strrchr(win32path, '\\') + 1, WIN32_PATH); + } + else strcpy(win32path,WIN32_PATH); + strcpy(tmppath,win32path); +#ifdef USE_REALCODECS + /* Expand to absolute path unless it's already absolute */ + if(!strstr(REALCODEC_PATH,":") && REALCODEC_PATH[0] != '\\'){ + GetModuleFileNameA(NULL, realpath, MAX_PATH); + strcpy(strrchr(realpath, '\\') + 1, REALCODEC_PATH); + } + else strcpy(realpath,REALCODEC_PATH); + sprintf(tmppath,"%s;%s",win32path,realpath); +#endif /*USE_REALCODECS*/ +#endif /*__CYGWIN__*/ + mp_msg(MSGT_WIN32, MSGL_V,"Setting PATH to %s\n",tmppath); + if (!SetEnvironmentVariableA("PATH", tmppath)) + mp_msg(MSGT_WIN32, MSGL_WARN, "Cannot set PATH!"); +} +#endif /*WIN32 && USE_WIN32DLL*/