Wrote uiprivReportError() on Windows. Now to fix the... lots of compiler errors :|

This commit is contained in:
Pietro Gagliardi 2019-05-27 10:45:55 -04:00
parent 3721bf0c8e
commit 2e82d4aad4
1 changed files with 16 additions and 0 deletions

View File

@ -146,3 +146,19 @@ void uiQueueMain(void (*f)(void *data), void *data)
// TODO handle error
}
}
void uiprivReportError(const char *prefix, const char *msg, const char *suffix, bool internal)
{
// Print to both stderr and the debugger; the former handles the case of a console and the latter handles the case of not.
// TODO find a reliable way to check if stderr is connected (the mere presence of a console window is not one)
fprintf(stderr, "*** %s: %s. %s\n", prefix, msg, suffix);
// Use OutputDebugStringA() directly because these *are* runtime MBCS strings.
OutputDebugStringA(prefix);
OutputDebugStringA(": ");
OutputDebugStringA(msg);
OutputDebugStringA(". ");
OutputDebugStringA(suffix);
OutputDebugStringA("\n");
DebugBreak();
abort(); // we shouldn't reach here
}