Skip to content

Commit

Permalink
Merge pull request #898 from sweiland-openrails/enh/extraParameterlin…
Browse files Browse the repository at this point in the history
…eInLog

Extra line with all the arguments for debugging purposes in logfile
  • Loading branch information
sweiland-openrails authored Dec 22, 2023
2 parents 23e1f0d + 2d1b44a commit 362e836
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Source/RunActivity/Viewer3D/Processes/GameStateRunActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ internal override void Load()
default:
MessageBox.Show("To start " + Application.ProductName + ", please run 'OpenRails.exe'.\n\n"
+ "If you are attempting to debug this component, please run 'OpenRails.exe' and execute the scenario you are interested in. "
+ "In the log file, the command-line arguments used will be listed at the top. "
+ "In the log file, a line with the command-line arguments used will be listed at the top. "
+ "You should then configure your debug environment to execute this component with those command-line arguments.",
Application.ProductName + " " + VersionInfo.VersionOrBuild);
Game.Exit();
Expand Down Expand Up @@ -819,6 +819,21 @@ void InitLogging(UserSettings settings, string[] args, bool appendLog)
Console.WriteLine("Executable = {0}", Path.GetFileName(Application.ExecutablePath));
foreach (var arg in args)
Console.WriteLine("Argument = {0}", arg);

string debugArgline = "";
foreach (var arg in args)
{
if (arg.Contains(" "))
{
debugArgline += "\"" + arg + "\" ";
}
else
{
debugArgline += arg + " ";
}
}
Console.WriteLine("Arguments = {0}", debugArgline.TrimEnd());

LogSeparator();
settings.Log();
LogSeparator();
Expand Down

0 comments on commit 362e836

Please sign in to comment.