Print '--version' and '--help' messages without timestamps

recast_test_fix_c17
Petr Mikheev 3 years ago
parent afaacedf67
commit 49c6e50c31

@ -73,6 +73,7 @@
Feature #390: 3rd person look "over the shoulder"
Feature #2386: Distant Statics in the form of Object Paging
Feature #2404: Levelled List can not be placed into a container
Feature #2686: Timestamps in openmw.log
Feature #4894: Consider actors as obstacles for pathfinding
Feature #5043: Head Bobbing
Feature #5297: Add a search function to the "Datafiles" tab of the OpenMW launcher

@ -135,7 +135,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
if (variables.count ("help"))
{
std::cout << desc << std::endl;
getRawStdout() << desc << std::endl;
return false;
}
@ -144,7 +144,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
cfgMgr.readConfiguration(variables, desc, true);
Version::Version v = Version::getOpenmwVersion(variables["resources"].as<Files::EscapePath>().mPath.string());
std::cout << v.describe() << std::endl;
getRawStdout() << v.describe() << std::endl;
return false;
}

@ -1,6 +1,7 @@
#include "debugging.hpp"
#include <chrono>
#include <memory>
#include <components/crashcatcher/crashcatcher.hpp>
@ -133,11 +134,19 @@ namespace Debug
}
}
static std::unique_ptr<std::ostream> rawStdout = nullptr;
std::ostream& getRawStdout()
{
return rawStdout ? *rawStdout : std::cout;
}
int wrapApplication(int (*innerApplication)(int argc, char *argv[]), int argc, char *argv[], const std::string& appName)
{
#if defined _WIN32
(void)Debug::attachParentConsole();
#endif
rawStdout = std::make_unique<std::ostream>(std::cout.rdbuf());
// Some objects used to redirect cout and cerr
// Scope must be here, so this still works inside the catch block for logging exceptions

@ -135,6 +135,9 @@ namespace Debug
#endif
}
// Can be used to print messages without timestamps
std::ostream& getRawStdout();
int wrapApplication(int (*innerApplication)(int argc, char *argv[]), int argc, char *argv[], const std::string& appName);
#endif

Loading…
Cancel
Save