Comment 2 for bug 1828355

Revision history for this message
fuchur (fuchur77) wrote :

The problem is the windows logger which is initialized in WLApplication::setup_homedir(). But there is a call of log() in WLApplication::WLApplication(int const argc, char const* const* const argv) before that happens. See source below

 if (commandline_.count("homedir")) {
  log("Adding home directory: %s\n", commandline_["homedir"].c_str()); // <-- this is it
  homedir_ = commandline_["homedir"];
  commandline_.erase("homedir");
 }
#ifdef REDIRECT_OUTPUT
 if (!redirect_output())
  redirect_output(homedir_);
#endif

 setup_homedir();

If the labeled line is changed to print the output using std::cout (maybe encapsuled by #ifdef _WIN32) or commented it works.

Windows doesn't have a stdout if you run a program using a shortcut. Therefore log() writes to a file stdout.txt which is saved in the homedir folder. I guess in Linux starting widelands from a shell stdout is always accessible -> no problem with log() before setting the homedir.

I assume in Linux one should see two messages about the home directory if one uses the homedir option. One stating "Adding home directory:" and the second one "Set home directory:".