aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
authorRachel Powers <508861+Ryex@users.noreply.github.com>2023-07-30 14:03:20 -0700
committerRachel Powers <508861+Ryex@users.noreply.github.com>2023-07-30 14:03:20 -0700
commita7ef6637353a6ccffae850c92a170813a704ec41 (patch)
treecdf02b1a455605c5c8cb5358a12f4ab4362636ac /launcher
parent186211244de92b432713759c14629234cf3e8c1a (diff)
downloadPrismLauncher-a7ef6637353a6ccffae850c92a170813a704ec41.tar.gz
PrismLauncher-a7ef6637353a6ccffae850c92a170813a704ec41.tar.bz2
PrismLauncher-a7ef6637353a6ccffae850c92a170813a704ec41.zip
fix(windows console): use new logic in FileLink exe
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Diffstat (limited to 'launcher')
-rw-r--r--launcher/filelink/FileLink.cpp22
1 files changed, 2 insertions, 20 deletions
diff --git a/launcher/filelink/FileLink.cpp b/launcher/filelink/FileLink.cpp
index c9599b82..e549fbe6 100644
--- a/launcher/filelink/FileLink.cpp
+++ b/launcher/filelink/FileLink.cpp
@@ -37,11 +37,7 @@
#include <sys.h>
#if defined Q_OS_WIN32
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include <stdio.h>
-#include <windows.h>
+#include "WindowsConsole.h"
#endif
// Snippet from https://github.com/gulrak/filesystem#using-it-as-single-file-header
@@ -67,21 +63,7 @@ FileLinkApp::FileLinkApp(int& argc, char** argv) : QCoreApplication(argc, argv),
{
#if defined Q_OS_WIN32
// attach the parent console
- if (AttachConsole(ATTACH_PARENT_PROCESS)) {
- // if attach succeeds, reopen and sync all the i/o
- if (freopen("CON", "w", stdout)) {
- std::cout.sync_with_stdio();
- }
- if (freopen("CON", "w", stderr)) {
- std::cerr.sync_with_stdio();
- }
- if (freopen("CON", "r", stdin)) {
- std::cin.sync_with_stdio();
- }
- auto out = GetStdHandle(STD_OUTPUT_HANDLE);
- DWORD written;
- const char* endline = "\n";
- WriteConsole(out, endline, strlen(endline), &written, NULL);
+ if (AttachWindowsConsole()) {
consoleAttached = true;
}
#endif