Add option to redirect cout/cerr to files

This commit is contained in:
Tamás Bálint Misius 2019-04-05 20:48:05 +02:00
parent ea4c355748
commit e3fefe30d1
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2

View File

@ -285,6 +285,7 @@ std::map<ByteString, ByteString> readArguments(int argc, char * argv[])
arguments["nohud"] = "false"; //the nohud, sound, and scripts commands currently do nothing.
arguments["sound"] = "false";
arguments["kiosk"] = "false";
arguments["redirect"] = "false";
arguments["scripts"] = "false";
arguments["open"] = "";
arguments["ddir"] = "";
@ -311,6 +312,10 @@ std::map<ByteString, ByteString> readArguments(int argc, char * argv[])
{
arguments["kiosk"] = "true";
}
else if (!strncmp(argv[i], "redirect", 8))
{
arguments["redirect"] = "true";
}
else if (!strncmp(argv[i], "sound", 5))
{
arguments["sound"] = "true";
@ -656,6 +661,12 @@ int main(int argc, char * argv[])
Client::Ref().SetPref("Fullscreen", fullscreen);
}
if(arguments["redirect"] == "true")
{
freopen("stdout.log", "w", stdout);
freopen("stderr.log", "w", stderr);
}
if(arguments["scale"].length())
{
scale = arguments["scale"].ToNumber<int>();