diff --git a/OpenRA.Game/Utilities.cs b/OpenRA.Game/Utilities.cs index 2111d4f2bb..5138c13b81 100644 --- a/OpenRA.Game/Utilities.cs +++ b/OpenRA.Game/Utilities.cs @@ -42,7 +42,7 @@ namespace OpenRA { Process p = new Process(); p.StartInfo.FileName = Utility; - p.StartInfo.Arguments = args; + p.StartInfo.Arguments = "{0} --SupportDir \"{1}\"".F(args, Game.SupportDir); p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = true; p.StartInfo.RedirectStandardOutput = true; @@ -58,7 +58,7 @@ namespace OpenRA { Process p = new Process(); p.StartInfo.FileName = Utility; - p.StartInfo.Arguments = args; + p.StartInfo.Arguments = "{0} --SupportDir \"{1}\"".F(args, Game.SupportDir); p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = true; p.StartInfo.RedirectStandardOutput = true; diff --git a/OpenRA.Utility/Program.cs b/OpenRA.Utility/Program.cs index 300f9a6035..5a4abaf6b3 100644 --- a/OpenRA.Utility/Program.cs +++ b/OpenRA.Utility/Program.cs @@ -31,7 +31,7 @@ namespace OpenRA.Utility ps.AddAccessRule(new PipeAccessRule("EVERYONE", (PipeAccessRights)2032031, AccessControlType.Allow)); return ps; } - + static void Main(string[] args) { var actions = new Dictionary>() @@ -62,13 +62,27 @@ namespace OpenRA.Utility pipe.WaitForConnection(); Console.SetOut(new StreamWriter(pipe) { AutoFlush = true }); } - - - var action = WithDefault( null, () => actions[args[0]]); - if (action == null) - PrintUsage(); - else - action(args); + i = Array.IndexOf(args, "--SupportDir"); + if (args.Length > 1 && i >= 0) + { + Log.LogPath = args[i+1] + Path.DirectorySeparatorChar + "Logs" + Path.DirectorySeparatorChar; + Console.WriteLine("LogPath: {0}", Log.LogPath); + } + try + { + throw new InvalidOperationException("foo"); + var action = WithDefault( null, () => actions[args[0]]); + if (action == null) + PrintUsage(); + else + action(args); + } + catch( Exception e ) + { + Log.AddChannel("utility", "utility.log"); + Log.Write("utility", "{0}", e.ToString()); + throw; + } if (piping) Console.Out.Close();