Skip to content
Permalink
Browse files

Add option to redirect cout/cerr to files

  • Loading branch information...
LBPHacker committed Apr 5, 2019
1 parent ea4c355 commit e3fefe30d1074a833bbb578b9e39a8729617ac00
Showing with 11 additions and 0 deletions.
  1. +11 −0 src/PowderToySDL.cpp
@@ -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>();

0 comments on commit e3fefe3

Please sign in to comment.
You can’t perform that action at this time.