forked from Mirrorlandia_minetest/minetest
master #6
@ -737,12 +737,14 @@ void osSpecificInit()
|
|||||||
void attachOrCreateConsole()
|
void attachOrCreateConsole()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static bool consoleAllocated = false;
|
static bool once = false;
|
||||||
const bool redirected = (_fileno(stdout) == -2 || _fileno(stdout) == -1); // If output is redirected to e.g a file
|
const bool redirected = _fileno(stdout) >= 0; // If output is redirected to e.g a file
|
||||||
if (!consoleAllocated && redirected && (AttachConsole(ATTACH_PARENT_PROCESS) || AllocConsole())) {
|
if (!once && !redirected) {
|
||||||
freopen("CONOUT$", "w", stdout);
|
if (AttachConsole(ATTACH_PARENT_PROCESS) || AllocConsole()) {
|
||||||
freopen("CONOUT$", "w", stderr);
|
freopen("CONOUT$", "w", stdout);
|
||||||
consoleAllocated = true;
|
freopen("CONOUT$", "w", stderr);
|
||||||
|
}
|
||||||
|
once = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user