Common/MsgHandler: Use fmt::print on non-Windows OSes

Provides the same behavior.
This commit is contained in:
Lioncash 2019-06-16 23:24:26 -04:00
parent b3525ad774
commit 027c17558f
1 changed files with 10 additions and 7 deletions

View File

@ -2,20 +2,23 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "Common/MsgHandler.h"
#include <cstdarg>
#include <cstdio>
#include <string>
#ifdef _WIN32
#include <windows.h>
#else
#include <cstdio>
#include <fmt/format.h>
#endif
#include "Common/Common.h"
#include "Common/CommonTypes.h"
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h"
#ifdef _WIN32
#include <windows.h>
#endif
bool DefaultMsgHandler(const char* caption, const char* text, bool yes_no, MsgType style);
static MsgAlertHandler msg_handler = DefaultMsgHandler;
static bool AlertEnabled = true;
@ -111,7 +114,7 @@ bool DefaultMsgHandler(const char* caption, const char* text, bool yes_no, MsgTy
return IDYES == MessageBox(0, UTF8ToTStr(text).c_str(), UTF8ToTStr(caption).c_str(),
window_style | (yes_no ? MB_YESNO : MB_OK));
#else
fprintf(stderr, "%s\n", text);
fmt::print(stderr, "{}\n", text);
// Return no to any question (which will in general crash the emulator)
return false;