Mercurial > sdl-ios-xcode
comparison src/main/win32/SDL_win32_main.c @ 1286:d7bca8c8161e
Use the executable directory, not the current directory, for stdio output files
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 29 Jan 2006 08:39:35 +0000 |
parents | ed57c876700d |
children | 3692456e7b0f |
comparison
equal
deleted
inserted
replaced
1285:c9ae23d221ea | 1286:d7bca8c8161e |
---|---|
264 { | 264 { |
265 HINSTANCE handle; | 265 HINSTANCE handle; |
266 char **argv; | 266 char **argv; |
267 int argc; | 267 int argc; |
268 char *cmdline; | 268 char *cmdline; |
269 DWORD pathlen; | |
270 #ifdef _WIN32_WCE | |
271 wchar_t path[MAX_PATH]; | |
272 #else | |
273 char path[MAX_PATH]; | |
274 #endif | |
269 #ifdef _WIN32_WCE | 275 #ifdef _WIN32_WCE |
270 wchar_t *bufp; | 276 wchar_t *bufp; |
271 int nLen; | 277 int nLen; |
272 #else | 278 #else |
273 char *bufp; | 279 char *bufp; |
284 if ( handle != NULL ) { | 290 if ( handle != NULL ) { |
285 FreeLibrary(handle); | 291 FreeLibrary(handle); |
286 } | 292 } |
287 | 293 |
288 #ifndef NO_STDIO_REDIRECT | 294 #ifndef NO_STDIO_REDIRECT |
289 _getcwd( stdoutPath, sizeof( stdoutPath ) ); | 295 pathlen = GetModuleFileName(NULL, path, SDL_TABLESIZE(path)); |
296 while ( pathlen > 0 && path[pathlen] != '\\' ) { | |
297 --pathlen; | |
298 } | |
299 path[pathlen] = '\0'; | |
300 | |
301 strcpy( stdoutPath, path ); | |
290 strcat( stdoutPath, DIR_SEPERATOR STDOUT_FILE ); | 302 strcat( stdoutPath, DIR_SEPERATOR STDOUT_FILE ); |
291 | 303 |
292 /* Redirect standard input and standard output */ | 304 /* Redirect standard input and standard output */ |
293 newfp = freopen(stdoutPath, TEXT("w"), stdout); | 305 newfp = freopen(stdoutPath, TEXT("w"), stdout); |
294 | 306 |
303 } | 315 } |
304 #endif | 316 #endif |
305 } | 317 } |
306 #endif /* _WIN32_WCE */ | 318 #endif /* _WIN32_WCE */ |
307 | 319 |
308 _getcwd( stderrPath, sizeof( stderrPath ) ); | 320 strcpy( stderrPath, path ); |
309 strcat( stderrPath, DIR_SEPERATOR STDERR_FILE ); | 321 strcat( stderrPath, DIR_SEPERATOR STDERR_FILE ); |
310 | 322 |
311 newfp = freopen(stderrPath, TEXT("w"), stderr); | 323 newfp = freopen(stderrPath, TEXT("w"), stderr); |
312 #ifndef _WIN32_WCE | 324 #ifndef _WIN32_WCE |
313 if ( newfp == NULL ) { /* This happens on NT */ | 325 if ( newfp == NULL ) { /* This happens on NT */ |