annotate get_path.c @ 24242:76f5d8892c04

Clean up the way get_path is handled: Compile get_path.c to an object to link against instead of directly #including the C file and replace the many extern declarations by a proper header file.
author diego
date Tue, 28 Aug 2007 11:20:24 +0000
parents 0a38ad149c5c
children 0fad7c7596be
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2557
6a74454ea121 some cleanup
arpi
parents:
diff changeset
1
12891
54ea3d6e657c added src level documentation for the get_path() function
al
parents: 12358
diff changeset
2 /*
54ea3d6e657c added src level documentation for the get_path() function
al
parents: 12358
diff changeset
3 * Get path to config dir/file.
54ea3d6e657c added src level documentation for the get_path() function
al
parents: 12358
diff changeset
4 *
54ea3d6e657c added src level documentation for the get_path() function
al
parents: 12358
diff changeset
5 * Return Values:
54ea3d6e657c added src level documentation for the get_path() function
al
parents: 12358
diff changeset
6 * Returns the pointer to the ALLOCATED buffer containing the
54ea3d6e657c added src level documentation for the get_path() function
al
parents: 12358
diff changeset
7 * zero terminated path string. This buffer has to be FREED
54ea3d6e657c added src level documentation for the get_path() function
al
parents: 12358
diff changeset
8 * by the caller.
54ea3d6e657c added src level documentation for the get_path() function
al
parents: 12358
diff changeset
9 *
54ea3d6e657c added src level documentation for the get_path() function
al
parents: 12358
diff changeset
10 */
24242
76f5d8892c04 Clean up the way get_path is handled: Compile get_path.c to an object to link
diego
parents: 23806
diff changeset
11
76f5d8892c04 Clean up the way get_path is handled: Compile get_path.c to an object to link
diego
parents: 23806
diff changeset
12 #include <stdio.h>
76f5d8892c04 Clean up the way get_path is handled: Compile get_path.c to an object to link
diego
parents: 23806
diff changeset
13 #include <stdlib.h>
76f5d8892c04 Clean up the way get_path is handled: Compile get_path.c to an object to link
diego
parents: 23806
diff changeset
14 #include <string.h>
76f5d8892c04 Clean up the way get_path is handled: Compile get_path.c to an object to link
diego
parents: 23806
diff changeset
15 #include "mp_msg.h"
76f5d8892c04 Clean up the way get_path is handled: Compile get_path.c to an object to link
diego
parents: 23806
diff changeset
16
15145
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
17 #ifdef MACOSX_BUNDLE
15237
55d9619d75e5 replace Carbon.h by coreFoundation.h, fix build with x11 enable on mac osx with --enable-macosx-bundle enable
nplourde
parents: 15145
diff changeset
18 #include <CoreFoundation/CoreFoundation.h>
15145
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
19 #include <sys/types.h>
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
20 #include <sys/stat.h>
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
21 #include <unistd.h>
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
22 #endif
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
23
18889
e60c8c7399d2 get_path as const, patch by Stefan Huehner, stefan AT huehner-org
reynaldo
parents: 16872
diff changeset
24 char *get_path(const char *filename){
2557
6a74454ea121 some cleanup
arpi
parents:
diff changeset
25 char *homedir;
6a74454ea121 some cleanup
arpi
parents:
diff changeset
26 char *buff;
10026
b8780122e043 Cygwin should behave like a Unix environment, i.e. config files should be
diego
parents: 9929
diff changeset
27 #if defined(__MINGW32__)
9926
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
28 static char *config_dir = "/mplayer";
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
29 #else
2557
6a74454ea121 some cleanup
arpi
parents:
diff changeset
30 static char *config_dir = "/.mplayer";
9926
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
31 #endif
2557
6a74454ea121 some cleanup
arpi
parents:
diff changeset
32 int len;
15145
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
33 #ifdef MACOSX_BUNDLE
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
34 struct stat dummy;
15625
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
35 CFIndex maxlen=256;
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
36 CFURLRef res_url_ref=NULL;
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
37 CFURLRef bdl_url_ref=NULL;
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
38 char *res_url_path = NULL;
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
39 char *bdl_url_path = NULL;
15145
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
40 #endif
2557
6a74454ea121 some cleanup
arpi
parents:
diff changeset
41
16872
9d4becb83656 Allow the user to set the $MPLAYER_HOME environment variable to point to the location
albeu
parents: 16781
diff changeset
42 if ((homedir = getenv("MPLAYER_HOME")) != NULL)
9d4becb83656 Allow the user to set the $MPLAYER_HOME environment variable to point to the location
albeu
parents: 16781
diff changeset
43 config_dir = "";
9d4becb83656 Allow the user to set the $MPLAYER_HOME environment variable to point to the location
albeu
parents: 16781
diff changeset
44 else if ((homedir = getenv("HOME")) == NULL)
9926
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
45 #if defined(__MINGW32__)||defined(__CYGWIN__) /*hack to get fonts etc. loaded outside of cygwin environment*/
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
46 {
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
47 int i,imax=0;
9929
faust3
parents: 9926
diff changeset
48 char exedir[260];
faust3
parents: 9926
diff changeset
49 GetModuleFileNameA(NULL, exedir, 260);
9926
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
50 for(i=0; i< strlen(exedir);i++)if(exedir[i] =='\\'){exedir[i]='/';imax=i;}
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
51 exedir[imax]='\0';
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
52 homedir = exedir;
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
53 }
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
54 #else
2557
6a74454ea121 some cleanup
arpi
parents:
diff changeset
55 return NULL;
9926
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
56 #endif
2557
6a74454ea121 some cleanup
arpi
parents:
diff changeset
57 len = strlen(homedir) + strlen(config_dir) + 1;
6a74454ea121 some cleanup
arpi
parents:
diff changeset
58 if (filename == NULL) {
23806
0a38ad149c5c Remove some more useless *alloc casts
reimar
parents: 18889
diff changeset
59 if ((buff = malloc(len)) == NULL)
2557
6a74454ea121 some cleanup
arpi
parents:
diff changeset
60 return NULL;
6a74454ea121 some cleanup
arpi
parents:
diff changeset
61 sprintf(buff, "%s%s", homedir, config_dir);
6a74454ea121 some cleanup
arpi
parents:
diff changeset
62 } else {
6a74454ea121 some cleanup
arpi
parents:
diff changeset
63 len += strlen(filename) + 1;
23806
0a38ad149c5c Remove some more useless *alloc casts
reimar
parents: 18889
diff changeset
64 if ((buff = malloc(len)) == NULL)
2557
6a74454ea121 some cleanup
arpi
parents:
diff changeset
65 return NULL;
6a74454ea121 some cleanup
arpi
parents:
diff changeset
66 sprintf(buff, "%s%s/%s", homedir, config_dir, filename);
6a74454ea121 some cleanup
arpi
parents:
diff changeset
67 }
15145
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
68
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
69 #ifdef MACOSX_BUNDLE
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
70 if(stat(buff, &dummy)) {
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
71
15625
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
72 res_url_ref=CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
73 bdl_url_ref=CFBundleCopyBundleURL(CFBundleGetMainBundle());
15145
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
74
15625
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
75 if(res_url_ref&&bdl_url_ref) {
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
76
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
77 res_url_path=malloc(maxlen);
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
78 bdl_url_path=malloc(maxlen);
15145
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
79
15625
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
80 while(!CFURLGetFileSystemRepresentation(res_url_ref, true, res_url_path, maxlen)) {
15145
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
81 maxlen*=2;
15625
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
82 res_url_path=realloc(res_url_path, maxlen);
15145
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
83 }
15625
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
84 CFRelease(res_url_ref);
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
85
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
86 while(!CFURLGetFileSystemRepresentation(bdl_url_ref, true, bdl_url_path, maxlen)) {
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
87 maxlen*=2;
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
88 bdl_url_path=realloc(bdl_url_path, maxlen);
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
89 }
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
90 CFRelease(bdl_url_ref);
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
91
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
92 if( strcmp(res_url_path, bdl_url_path) == 0)
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
93 res_url_path = NULL;
15145
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
94 }
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
95
15625
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
96 if(res_url_path&&filename) {
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
97 if((strlen(filename)+strlen(res_url_path)+2)>maxlen) {
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
98 maxlen=strlen(filename)+strlen(res_url_path)+2;
15145
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
99 }
15625
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
100 free(buff);
23806
0a38ad149c5c Remove some more useless *alloc casts
reimar
parents: 18889
diff changeset
101 buff = malloc(maxlen);
15625
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
102 strcpy(buff, res_url_path);
4be161b8e0ef compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents: 15237
diff changeset
103
15145
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
104 strcat(buff,"/");
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
105 strcat(buff, filename);
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
106 }
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
107 }
a7f11c8091e4 allows the Mac OS X version of MPlayer to look for its data files inside the Resources directory of the appwrapper. patch by Chris Roccati <roccati@pobox.com>
nplourde
parents: 12891
diff changeset
108 #endif
3746
d21bae2028a6 some debugging
arpi
parents: 2557
diff changeset
109 mp_msg(MSGT_GLOBAL,MSGL_V,"get_path('%s') -> '%s'\n",filename,buff);
2557
6a74454ea121 some cleanup
arpi
parents:
diff changeset
110 return buff;
6a74454ea121 some cleanup
arpi
parents:
diff changeset
111 }
16781
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
112
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
113 #if defined(WIN32) && defined(USE_WIN32DLL)
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
114 void set_path_env()
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
115 {
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
116 /*make our codec dirs available for LoadLibraryA()*/
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
117 char tmppath[MAX_PATH*2 + 1];
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
118 char win32path[MAX_PATH];
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
119 char realpath[MAX_PATH];
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
120 #ifdef __CYGWIN__
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
121 cygwin_conv_to_full_win32_path(WIN32_PATH,win32path);
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
122 strcpy(tmppath,win32path);
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
123 #ifdef USE_REALCODECS
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
124 cygwin_conv_to_full_win32_path(REALCODEC_PATH,realpath);
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
125 sprintf(tmppath,"%s;%s",win32path,realpath);
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
126 #endif /*USE_REALCODECS*/
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
127 #else /*__CYGWIN__*/
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
128 /* Expand to absolute path unless it's already absolute */
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
129 if(!strstr(WIN32_PATH,":") && WIN32_PATH[0] != '\\'){
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
130 GetModuleFileNameA(NULL, win32path, MAX_PATH);
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
131 strcpy(strrchr(win32path, '\\') + 1, WIN32_PATH);
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
132 }
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
133 else strcpy(win32path,WIN32_PATH);
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
134 strcpy(tmppath,win32path);
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
135 #ifdef USE_REALCODECS
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
136 /* Expand to absolute path unless it's already absolute */
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
137 if(!strstr(REALCODEC_PATH,":") && REALCODEC_PATH[0] != '\\'){
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
138 GetModuleFileNameA(NULL, realpath, MAX_PATH);
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
139 strcpy(strrchr(realpath, '\\') + 1, REALCODEC_PATH);
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
140 }
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
141 else strcpy(realpath,REALCODEC_PATH);
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
142 sprintf(tmppath,"%s;%s",win32path,realpath);
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
143 #endif /*USE_REALCODECS*/
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
144 #endif /*__CYGWIN__*/
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
145 mp_msg(MSGT_WIN32, MSGL_V,"Setting PATH to %s\n",tmppath);
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
146 if (!SetEnvironmentVariableA("PATH", tmppath))
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
147 mp_msg(MSGT_WIN32, MSGL_WARN, "Cannot set PATH!");
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
148 }
6809ca5dd307 allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents: 15625
diff changeset
149 #endif /*WIN32 && USE_WIN32DLL*/