Skip to content

Commit

Permalink
Log where it is written to
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaPiggy committed Aug 31, 2024
1 parent 349ed00 commit a1b4153
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Winch/Util/DialogueUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,13 @@ public DredgeInstruction(string nodeID, int index, string label, Yarn.Instructio
}
}

internal static string GetProgramFileLocation(string fileName) => Path.Combine(WinchCore.WinchInstallLocation, $"{fileName}.txt");

internal static void WriteYarnProgramToText(string fileName, Program program)
{
File.WriteAllText(Path.Combine(WinchCore.WinchInstallLocation, $"{fileName}.txt"), YarnProgramToText(program));
var path = GetProgramFileLocation(fileName);
File.WriteAllText(path, YarnProgramToText(program));
WinchCore.Log.Debug("Yarn program written to " + path);
}

internal static string YarnProgramToText(Program program)
Expand Down Expand Up @@ -390,5 +394,6 @@ internal static void WriteYarnProgramCommand(CommandArg[] args)
DredgeDialogueRunner runner = GameManager.Instance.DialogueRunner;
Program program = Traverse.Create(runner.Dialogue).Field("program").GetValue<Program>();
WriteYarnProgramToText("YarnProgram", program);
Terminal.Buffer.HandleLog("Yarn program written to " + GetProgramFileLocation("YarnProgram"), TerminalLogType.Message);
}
}

0 comments on commit a1b4153

Please sign in to comment.