Mercurial > hg > svcore
comparison system/Init.cpp @ 658:29efe322ab47
* Build fixes
author | Chris Cannam |
---|---|
date | Mon, 18 Oct 2010 12:42:42 +0100 |
parents | 4884fba80e00 |
children | b0fde2a60188 |
comparison
equal
deleted
inserted
replaced
657:1bb85de8c5b9 | 658:29efe322ab47 |
---|---|
12 License, or (at your option) any later version. See the file | 12 License, or (at your option) any later version. See the file |
13 COPYING included with this distribution for more information. | 13 COPYING included with this distribution for more information. |
14 */ | 14 */ |
15 | 15 |
16 #include <iostream> | 16 #include <iostream> |
17 | |
18 #include <qglobal.h> | |
17 | 19 |
18 #ifdef Q_WS_X11 | 20 #ifdef Q_WS_X11 |
19 #include <X11/Xlib.h> | 21 #include <X11/Xlib.h> |
20 #include <X11/Xutil.h> | 22 #include <X11/Xutil.h> |
21 #include <X11/Xatom.h> | 23 #include <X11/Xatom.h> |
36 #endif | 38 #endif |
37 | 39 |
38 #ifdef Q_WS_WIN32 | 40 #ifdef Q_WS_WIN32 |
39 | 41 |
40 #include <fcntl.h> | 42 #include <fcntl.h> |
43 | |
44 // required for SetDllDirectory | |
45 #define _WIN32_WINNT 0x0502 | |
41 #include <windows.h> | 46 #include <windows.h> |
42 | 47 |
43 // Set default file open mode to binary | 48 // Set default file open mode to binary |
44 //#undef _fmode | 49 //#undef _fmode |
45 //int _fmode = _O_BINARY; | 50 //int _fmode = _O_BINARY; |
46 | 51 |
47 void redirectStderr() | 52 void redirectStderr() |
48 { | 53 { |
54 #ifdef NO_PROBABLY_NOT | |
49 HANDLE stderrHandle = GetStdHandle(STD_ERROR_HANDLE); | 55 HANDLE stderrHandle = GetStdHandle(STD_ERROR_HANDLE); |
50 if (!stderrHandle) return; | 56 if (!stderrHandle) return; |
51 | 57 |
52 AllocConsole(); | 58 AllocConsole(); |
53 | 59 |
62 if (fd) { | 68 if (fd) { |
63 *stderr = *fd; | 69 *stderr = *fd; |
64 setvbuf(stderr, NULL, _IONBF, 0); | 70 setvbuf(stderr, NULL, _IONBF, 0); |
65 } | 71 } |
66 } | 72 } |
73 #endif | |
67 } | 74 } |
68 | 75 |
69 #endif | 76 #endif |
70 | 77 |
71 extern void svSystemSpecificInitialisation() | 78 extern void svSystemSpecificInitialisation() |
74 XSetErrorHandler(handle_x11_error); | 81 XSetErrorHandler(handle_x11_error); |
75 #endif | 82 #endif |
76 | 83 |
77 #ifdef Q_WS_WIN32 | 84 #ifdef Q_WS_WIN32 |
78 redirectStderr(); | 85 redirectStderr(); |
86 | |
87 // Remove the CWD from the DLL search path, just in case | |
88 SetDllDirectory(L""); | |
89 putenv("PATH="); | |
79 #else | 90 #else |
80 #endif | 91 #endif |
81 } | 92 } |
82 | 93 |
83 | 94 |