Skip to content

Commit

Permalink
Increase logging for PB script compilation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gwindalmir committed Oct 12, 2021
1 parent 631746c commit e700d01
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion WorkshopToolCommon/Uploader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ public bool Compile()
#if SE
else if(m_type == WorkshopType.IngameScript)
{
MySandboxGame.Log.WriteLineAndConsole("Compiling...");
// Load the ingame script from the disk
// I don't like this, but meh
var input = new StreamReader(Path.Combine(m_modPath, "Script.cs"));
Expand All @@ -245,7 +246,7 @@ public bool Compile()
scripts.Add(MyScriptCompiler.Static.GetIngameScript(program, "Program", typeof(Sandbox.ModAPI.Ingame.MyGridProgram).Name, "sealed partial"));

var messages = new List<Message>();
var assembly = MyVRage.Platform.Scripting.CompileIngameScriptAsync(Path.Combine(VRage.FileSystem.MyFileSystem.UserDataPath, "SEWT-Script" + Path.GetFileName(m_modPath)), program, out messages, "SEWT Compiled PB Script", "Program", typeof(Sandbox.ModAPI.Ingame.MyGridProgram).Name).Result;
var assembly = MyVRage.Platform.Scripting.CompileIngameScriptAsync(Path.Combine(VRage.FileSystem.MyFileSystem.UserDataPath, "SEWT-Script - " + Path.GetFileName(m_modPath)), program, out messages, "SEWT Compiled PB Script", "Program", typeof(Sandbox.ModAPI.Ingame.MyGridProgram).Name).Result;

if (messages.Count > 0)
{
Expand All @@ -262,12 +263,19 @@ public bool Compile()
}
if (errors > 0)
{
MySandboxGame.Log.WriteLineError("Compilation FAILED!");
return false;
}
}

if (assembly == null)
{
// How can this happen?
MySandboxGame.Log.WriteLineError("Compilation FAILED!");
return false;
}

MySandboxGame.Log.WriteLineAndConsole("Compilation successful!");
}
#endif
return true;
Expand Down

0 comments on commit e700d01

Please sign in to comment.