Merge pull request #998 from djtuBIG-MaliceX/bugfix/#643-win32-console-vs-gui-strategy
Issue #643 - Rewrite CLI vs GUI strategy (this matches another tracker)
This commit is contained in:
commit
6e3352e052
|
@ -780,6 +780,8 @@ endif()
|
||||||
|
|
||||||
if(ANDROID AND NOT TERMUX)
|
if(ANDROID AND NOT TERMUX)
|
||||||
add_library(furnace SHARED ${USED_SOURCES})
|
add_library(furnace SHARED ${USED_SOURCES})
|
||||||
|
elseif(WIN32)
|
||||||
|
add_executable(furnace WIN32 ${USED_SOURCES})
|
||||||
else()
|
else()
|
||||||
add_executable(furnace ${USED_SOURCES})
|
add_executable(furnace ${USED_SOURCES})
|
||||||
endif()
|
endif()
|
||||||
|
|
12
src/main.cpp
12
src/main.cpp
|
@ -342,12 +342,14 @@ void reportError(String what) {
|
||||||
// TODO: CoInitializeEx on Windows?
|
// TODO: CoInitializeEx on Windows?
|
||||||
// TODO: add crash log
|
// TODO: add crash log
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
// Windows console thing - thanks MarioKart7z!
|
// Windows console thing - thanks dj.tuBIG/MaliceX
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DWORD winPID;
|
|
||||||
HWND winConsole=GetConsoleWindow();
|
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
|
||||||
GetWindowThreadProcessId(winConsole,&winPID);
|
freopen("CONOUT$", "w", stdout);
|
||||||
if (GetCurrentProcessId()==winPID) FreeConsole();
|
freopen("CONOUT$", "w", stderr);
|
||||||
|
freopen("CONIN$", "r", stdin);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
initLog();
|
initLog();
|
||||||
|
|
Loading…
Reference in New Issue