Exchange binary messages between navmeshtool and launcher

This commit is contained in:
elsid 2021-12-19 22:49:41 +01:00
parent a21c17ab26
commit 2d5ccc804b
No known key found for this signature in database
GPG key ID: B845CB9FEE18AB40
16 changed files with 496 additions and 50 deletions

View file

@ -138,6 +138,7 @@ namespace Debug
static std::unique_ptr<std::ostream> rawStdout = nullptr;
static std::unique_ptr<std::ostream> rawStderr = nullptr;
static std::unique_ptr<std::mutex> rawStderrMutex = nullptr;
static boost::filesystem::ofstream logfile;
#if defined(_WIN32) && defined(_DEBUG)
@ -152,6 +153,16 @@ std::ostream& getRawStdout()
return rawStdout ? *rawStdout : std::cout;
}
std::ostream& getRawStderr()
{
return rawStderr ? *rawStderr : std::cerr;
}
Misc::Locked<std::ostream&> getLockedRawStderr()
{
return Misc::Locked<std::ostream&>(*rawStderrMutex, getRawStderr());
}
// Redirect cout and cerr to the log file
void setupLogging(const std::string& logDir, const std::string& appName, std::ios_base::openmode mode)
{
@ -180,6 +191,7 @@ int wrapApplication(int (*innerApplication)(int argc, char *argv[]), int argc, c
#endif
rawStdout = std::make_unique<std::ostream>(std::cout.rdbuf());
rawStderr = std::make_unique<std::ostream>(std::cerr.rdbuf());
rawStderrMutex = std::make_unique<std::mutex>();
int ret = 0;
try