summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorAnthony <Helios747@users.noreply.github.com>2017-03-28 09:17:02 -0700
committerGitHub <noreply@github.com>2017-03-28 09:17:02 -0700
commitcdd3ac023ca850fcb68e67358ce7ef38c1f39d22 (patch)
tree37085eac7e4f1ed2493f0cfaad48c964d2950569 /Source
parent2c531889b26da2ac3fa7a046e988c15fe2e043b2 (diff)
parentc1cd7d9c0ea54cc2d11b27ee9f207f04bbcd75cc (diff)
Merge pull request #5133 from leoetlino/ugh-windows
Fix issues introduced by cpp-optparse on Windows
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/DolphinWX/Main.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/Source/Core/DolphinWX/Main.cpp b/Source/Core/DolphinWX/Main.cpp
index 934697ddab..91133a4e57 100644
--- a/Source/Core/DolphinWX/Main.cpp
+++ b/Source/Core/DolphinWX/Main.cpp
@@ -91,7 +91,6 @@ bool DolphinApp::OnCmdLineParsed(wxCmdLineParser& parser)
bool DolphinApp::OnInit()
{
- std::lock_guard<std::mutex> lk(s_init_mutex);
if (!wxApp::OnInit())
return false;
@@ -108,8 +107,20 @@ bool DolphinApp::OnInit()
wxHandleFatalExceptions(true);
#endif
+#ifdef _WIN32
+ const bool console_attached = AttachConsole(ATTACH_PARENT_PROCESS) != FALSE;
+ HANDLE stdout_handle = ::GetStdHandle(STD_OUTPUT_HANDLE);
+ if (console_attached && stdout_handle)
+ {
+ freopen("CONOUT$", "w", stdout);
+ freopen("CONOUT$", "w", stderr);
+ }
+#endif
+
ParseCommandLine();
+ std::lock_guard<std::mutex> lk(s_init_mutex);
+
UICommon::SetUserDirectory(m_user_path.ToStdString());
UICommon::CreateDirectories();
InitLanguageSupport(); // The language setting is loaded from the user directory