Merge pull request #5133 from leoetlino/ugh-windows

Fix issues introduced by cpp-optparse on Windows
This commit is contained in:
Anthony 2017-03-28 09:17:02 -07:00 committed by GitHub
commit cdd3ac023c
1 changed files with 12 additions and 1 deletions

View File

@ -91,7 +91,6 @@ bool DolphinApp::OnCmdLineParsed(wxCmdLineParser& parser)
bool DolphinApp::OnInit() bool DolphinApp::OnInit()
{ {
std::lock_guard<std::mutex> lk(s_init_mutex);
if (!wxApp::OnInit()) if (!wxApp::OnInit())
return false; return false;
@ -108,8 +107,20 @@ bool DolphinApp::OnInit()
wxHandleFatalExceptions(true); wxHandleFatalExceptions(true);
#endif #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(); ParseCommandLine();
std::lock_guard<std::mutex> lk(s_init_mutex);
UICommon::SetUserDirectory(m_user_path.ToStdString()); UICommon::SetUserDirectory(m_user_path.ToStdString());
UICommon::CreateDirectories(); UICommon::CreateDirectories();
InitLanguageSupport(); // The language setting is loaded from the user directory InitLanguageSupport(); // The language setting is loaded from the user directory