diff --git a/sandbox/ReferenceBuilder/Program.cs b/sandbox/ReferenceBuilder/Program.cs index 18c89594..d90ce444 100644 --- a/sandbox/ReferenceBuilder/Program.cs +++ b/sandbox/ReferenceBuilder/Program.cs @@ -1,13 +1,17 @@ using MarkdownGenerator; +using System.Reflection; var f = Factory(); var o = Operator(); -File.WriteAllText("../../../../../docs/reference_factory.md", f); -File.WriteAllText("../../../../../docs/reference_operator.md", o); +// Get absolute path of bin/Debug/TargetFramework/ReferenceBuilder.dll +// Location = /Foo/Bar/R3/sandbox/ReferenceBuilder/bin/Debug/net8.0/ReferenceBuilder.dll +var basePath = Assembly.GetAssembly(typeof(Program))!.Location; +File.WriteAllText(Path.Combine(basePath, "../../../../../../docs/reference_factory.md"), f); +File.WriteAllText(Path.Combine(basePath, "../../../../../../docs/reference_operator.md"), o); // replace readme -var text = File.ReadAllLines("../../../../../ReadMe.md"); +var text = File.ReadAllLines(Path.Combine(basePath, "../../../../../../ReadMe.md")); (int head, int tail)? factoryLines = null; (int head, int tail)? operatorLines = null; @@ -84,7 +88,7 @@ } var nt = string.Join(Environment.NewLine, newText); -File.WriteAllText("../../../../../ReadMe.md", nt); +File.WriteAllText(Path.Combine(basePath, "../../../../../../ReadMe.md"), nt); static string Factory() {