From: James Turner Date: Wed, 6 Feb 2013 18:05:33 +0000 (+0100) Subject: Log to file inside FG_HOME. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0ced6a24a0928f9729defe2de09f76f749a925d4;p=flightgear.git Log to file inside FG_HOME. --- diff --git a/src/Main/main.cxx b/src/Main/main.cxx index b51bd01a0..e1b98d3c3 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -313,6 +313,18 @@ int fgMainInit( int argc, char **argv ) { SG_LOG( SG_GENERAL, SG_ALERT, "Config option parsing failed ..." ); exit(-1); } + + SGPath logPath = globals->get_fg_home(); + logPath.append("fgfs.log"); + if (logPath.exists()) { + SGPath prevLogPath = globals->get_fg_home(); + prevLogPath.append("fgfs_0.log"); + logPath.rename(prevLogPath); + // bit strange, we need to restore the correct value of logPath now + logPath = globals->get_fg_home(); + logPath.append("fgfs.log"); + } + sglog().logToFile(logPath, SG_ALL, SG_INFO); // Initialize the Window/Graphics environment. fgOSInit(&argc, argv);