Mercurial > mplayer.hg
annotate get_path.c @ 27741:0401eef4408f
cosmetics: Move _def_fast_unaligned to the FFmpeg section of config.h.
author | diego |
---|---|
date | Tue, 14 Oct 2008 23:15:10 +0000 |
parents | 48c1ae64255b |
children | fe1ef9daa92e |
rev | line source |
---|---|
12891
54ea3d6e657c
added src level documentation for the get_path() function
al
parents:
12358
diff
changeset
|
1 /* |
54ea3d6e657c
added src level documentation for the get_path() function
al
parents:
12358
diff
changeset
|
2 * Get path to config dir/file. |
54ea3d6e657c
added src level documentation for the get_path() function
al
parents:
12358
diff
changeset
|
3 * |
54ea3d6e657c
added src level documentation for the get_path() function
al
parents:
12358
diff
changeset
|
4 * Return Values: |
54ea3d6e657c
added src level documentation for the get_path() function
al
parents:
12358
diff
changeset
|
5 * Returns the pointer to the ALLOCATED buffer containing the |
54ea3d6e657c
added src level documentation for the get_path() function
al
parents:
12358
diff
changeset
|
6 * 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
|
7 * by the caller. |
54ea3d6e657c
added src level documentation for the get_path() function
al
parents:
12358
diff
changeset
|
8 */ |
24242
76f5d8892c04
Clean up the way get_path is handled: Compile get_path.c to an object to link
diego
parents:
23806
diff
changeset
|
9 |
76f5d8892c04
Clean up the way get_path is handled: Compile get_path.c to an object to link
diego
parents:
23806
diff
changeset
|
10 #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
|
11 #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
|
12 #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
|
13 #include "mp_msg.h" |
27284 | 14 #include "get_path.h" |
24242
76f5d8892c04
Clean up the way get_path is handled: Compile get_path.c to an object to link
diego
parents:
23806
diff
changeset
|
15 |
27397
d47744b95b78
Give a CONFIG_ prefix to preprocessor directives that lacked one and
diego
parents:
27341
diff
changeset
|
16 #ifdef CONFIG_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
|
17 #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
|
18 #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
|
19 #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
|
20 #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
|
21 #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
|
22 |
27722 | 23 #ifdef __MINGW32__ |
24266 | 24 #include <windows.h> |
25 #endif | |
26 | |
27722 | 27 #ifdef __CYGWIN__ |
28 #include <windows.h> | |
29 #include <sys/cygwin.h> | |
30 #endif | |
31 | |
26056
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
32 #ifdef __OS2__ |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
33 #define INCL_DOS |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
34 #include <os2.h> |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
35 #endif |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
36 |
18889
e60c8c7399d2
get_path as const, patch by Stefan Huehner, stefan AT huehner-org
reynaldo
parents:
16872
diff
changeset
|
37 char *get_path(const char *filename){ |
2557 | 38 char *homedir; |
39 char *buff; | |
24267
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
40 #ifdef __MINGW32__ |
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
41 static char *config_dir = "/mplayer"; |
9926
ad429d617df4
allow config file loading outside of cygwin environment
faust3
parents:
3746
diff
changeset
|
42 #else |
2557 | 43 static char *config_dir = "/.mplayer"; |
9926
ad429d617df4
allow config file loading outside of cygwin environment
faust3
parents:
3746
diff
changeset
|
44 #endif |
2557 | 45 int len; |
27397
d47744b95b78
Give a CONFIG_ prefix to preprocessor directives that lacked one and
diego
parents:
27341
diff
changeset
|
46 #ifdef CONFIG_MACOSX_BUNDLE |
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
|
47 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
|
48 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
|
49 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
|
50 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
|
51 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
|
52 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
|
53 #endif |
2557 | 54 |
16872
9d4becb83656
Allow the user to set the $MPLAYER_HOME environment variable to point to the location
albeu
parents:
16781
diff
changeset
|
55 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
|
56 config_dir = ""; |
9d4becb83656
Allow the user to set the $MPLAYER_HOME environment variable to point to the location
albeu
parents:
16781
diff
changeset
|
57 else if ((homedir = getenv("HOME")) == NULL) |
24267
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
58 #if defined(__MINGW32__) || defined(__CYGWIN__) |
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
59 /* Hack to get fonts etc. loaded outside of Cygwin environment. */ |
9926
ad429d617df4
allow config file loading outside of cygwin environment
faust3
parents:
3746
diff
changeset
|
60 { |
24267
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
61 int i,imax=0; |
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
62 char exedir[260]; |
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
63 GetModuleFileNameA(NULL, exedir, 260); |
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
64 for (i=0; i< strlen(exedir); i++) |
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
65 if (exedir[i] =='\\') |
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
66 {exedir[i]='/'; imax=i;} |
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
67 exedir[imax]='\0'; |
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
68 homedir = exedir; |
9926
ad429d617df4
allow config file loading outside of cygwin environment
faust3
parents:
3746
diff
changeset
|
69 } |
26056
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
70 #elif defined(__OS2__) |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
71 { |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
72 PPIB ppib; |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
73 char path[260]; |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
74 |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
75 // Get process info blocks |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
76 DosGetInfoBlocks(NULL, &ppib); |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
77 |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
78 // Get full path of the executable |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
79 DosQueryModuleName(ppib->pib_hmte, sizeof( path ), path); |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
80 |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
81 // Truncate name part including last backslash |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
82 *strrchr(path, '\\') = 0; |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
83 |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
84 // Convert backslash to slash |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
85 _fnslashify(path); |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
86 |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
87 homedir = path; |
5ce6348b1a6e
On OS/2, fall back on the directory where MPlayer is installed if both
diego
parents:
24267
diff
changeset
|
88 } |
9926
ad429d617df4
allow config file loading outside of cygwin environment
faust3
parents:
3746
diff
changeset
|
89 #else |
24267
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
90 return NULL; |
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
91 #endif |
2557 | 92 len = strlen(homedir) + strlen(config_dir) + 1; |
93 if (filename == NULL) { | |
23806 | 94 if ((buff = malloc(len)) == NULL) |
2557 | 95 return NULL; |
96 sprintf(buff, "%s%s", homedir, config_dir); | |
97 } else { | |
98 len += strlen(filename) + 1; | |
23806 | 99 if ((buff = malloc(len)) == NULL) |
2557 | 100 return NULL; |
101 sprintf(buff, "%s%s/%s", homedir, config_dir, filename); | |
102 } | |
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
|
103 |
27397
d47744b95b78
Give a CONFIG_ prefix to preprocessor directives that lacked one and
diego
parents:
27341
diff
changeset
|
104 #ifdef CONFIG_MACOSX_BUNDLE |
24267
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
105 if (stat(buff, &dummy)) { |
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
106 |
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
|
107 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
|
108 bdl_url_ref=CFBundleCopyBundleURL(CFBundleGetMainBundle()); |
24267
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
109 |
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
110 if (res_url_ref&&bdl_url_ref) { |
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
|
111 |
4be161b8e0ef
compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents:
15237
diff
changeset
|
112 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
|
113 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
|
114 |
24267
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
115 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
|
116 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
|
117 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
|
118 } |
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
|
119 CFRelease(res_url_ref); |
24267
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
120 |
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
121 while (!CFURLGetFileSystemRepresentation(bdl_url_ref, true, bdl_url_path, 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
|
122 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
|
123 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
|
124 } |
4be161b8e0ef
compare resource url with bundle url, if its the same path do not use has conf file location.
nplourde
parents:
15237
diff
changeset
|
125 CFRelease(bdl_url_ref); |
24267
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
126 |
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
127 if (strcmp(res_url_path, bdl_url_path) == 0) |
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
|
128 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
|
129 } |
24267
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
130 |
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
131 if (res_url_path&&filename) { |
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
132 if ((strlen(filename)+strlen(res_url_path)+2)>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
|
133 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
|
134 } |
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
|
135 free(buff); |
23806 | 136 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
|
137 strcpy(buff, res_url_path); |
24267
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
138 |
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
|
139 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
|
140 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
|
141 } |
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
|
142 } |
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
|
143 #endif |
3746 | 144 mp_msg(MSGT_GLOBAL,MSGL_V,"get_path('%s') -> '%s'\n",filename,buff); |
2557 | 145 return buff; |
146 } | |
16781
6809ca5dd307
allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents:
15625
diff
changeset
|
147 |
27727
48c1ae64255b
Replace preprocessor check for WIN32 with checks for __MINGW32__ and __CYGWIN__.
diego
parents:
27722
diff
changeset
|
148 #if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL) |
16781
6809ca5dd307
allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents:
15625
diff
changeset
|
149 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
|
150 { |
6809ca5dd307
allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents:
15625
diff
changeset
|
151 /*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
|
152 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
|
153 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
|
154 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
|
155 #ifdef __CYGWIN__ |
6809ca5dd307
allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents:
15625
diff
changeset
|
156 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
|
157 strcpy(tmppath,win32path); |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
27284
diff
changeset
|
158 #ifdef CONFIG_REALCODECS |
16781
6809ca5dd307
allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents:
15625
diff
changeset
|
159 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
|
160 sprintf(tmppath,"%s;%s",win32path,realpath); |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
27284
diff
changeset
|
161 #endif /*CONFIG_REALCODECS*/ |
16781
6809ca5dd307
allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents:
15625
diff
changeset
|
162 #else /*__CYGWIN__*/ |
6809ca5dd307
allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents:
15625
diff
changeset
|
163 /* Expand to absolute path unless it's already absolute */ |
24267
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
164 if (!strstr(WIN32_PATH,":") && WIN32_PATH[0] != '\\'){ |
16781
6809ca5dd307
allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents:
15625
diff
changeset
|
165 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
|
166 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
|
167 } |
6809ca5dd307
allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents:
15625
diff
changeset
|
168 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
|
169 strcpy(tmppath,win32path); |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
27284
diff
changeset
|
170 #ifdef CONFIG_REALCODECS |
16781
6809ca5dd307
allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents:
15625
diff
changeset
|
171 /* Expand to absolute path unless it's already absolute */ |
24267
70437b99ccee
cosmetics: Fix up whitespace, indentation and similar things.
diego
parents:
24266
diff
changeset
|
172 if (!strstr(REALCODEC_PATH,":") && REALCODEC_PATH[0] != '\\'){ |
16781
6809ca5dd307
allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents:
15625
diff
changeset
|
173 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
|
174 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
|
175 } |
6809ca5dd307
allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents:
15625
diff
changeset
|
176 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
|
177 sprintf(tmppath,"%s;%s",win32path,realpath); |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
27284
diff
changeset
|
178 #endif /*CONFIG_REALCODECS*/ |
16781
6809ca5dd307
allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents:
15625
diff
changeset
|
179 #endif /*__CYGWIN__*/ |
6809ca5dd307
allow mencoder to load win32 codecs properly patch by Zuxy <zuxy.meng at gmail.com>
faust3
parents:
15625
diff
changeset
|
180 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
|
181 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
|
182 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
|
183 } |
27727
48c1ae64255b
Replace preprocessor check for WIN32 with checks for __MINGW32__ and __CYGWIN__.
diego
parents:
27722
diff
changeset
|
184 #endif /* (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL) */ |