Hi,

Tangentially related to the subject of the user config+data dir changes on 
Windows, I've just switched the log files location as well.

I've decided to provide you with two versions of this post so that hopefully 
no-one will need to ask later why they can't find stderr.txt anymore.


tl;dr Version
-------------

<install dir>\stderr.txt ---> <log dir>\wesnoth-<TS>-<PID>.log
<install dir>\stdout.txt -/

<log dir> before user data dir initialization: %TEMP%
<log dir> after user data dir initialization:  <user data dir>\logs


Technical Version
-----------------

Now stdout and stderr are both written to a single file, `<user data 
dir>\logs\wesnoth-<TIMESTAMP>-<PID>.log`. Up to 8 previous files are kept 
around for convenience, any additional log files are deleted on startup.

If Wesnoth has to quit before setting up the user data dir for the first time 
during startup, the log will get stuck in `%TEMP%\wesnoth-<TIMESTAMP>-
<PID>.log` instead, but this should be a reasonably rare occurrence.

As a bonus, I expect that this also fixes bug #22897 [1]; or at the very 
least, paves the way for a more complete fix (if needed at all).

    1: https://gna.org/bugs/index.php?22897

Until we phase out SDL 1.2 in production, the real WinMain() entry point 
provided by SDLmain.lib will continue to set up its own stdout/stderr 
redirection, generating the usual stdout.txt and stderr.txt pair in the 
process working directory. However, those become irrelevant before anything 
has a chance to write to them (hopefully, most of the time anyway), so the 
atexit handler also installed by SDLmain.lib will see that they are empty and 
erase them on exit.

-- 
Regards
  Ignacio R. Morelle <shadowm>

_______________________________________________
Wesnoth-dev mailing list
Wesnoth-dev@gna.org
https://mail.gna.org/listinfo/wesnoth-dev

Reply via email to