From d47343fe3d53d87828c5351344c39b8cab52010b Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Tue, 30 Jan 2024 12:49:25 -0300 Subject: [PATCH] Remove local path discovery for AOT support Keep it only for debug versions since it's useful when locally tweaking the templates during development. Fixes #279 --- src/EmbeddedResource.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/EmbeddedResource.cs b/src/EmbeddedResource.cs index 018b5475..bc664a20 100644 --- a/src/EmbeddedResource.cs +++ b/src/EmbeddedResource.cs @@ -1,12 +1,4 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - +// using System; using System.IO; using System.Linq; @@ -14,7 +6,9 @@ static class EmbeddedResource { +#if DEBUG static readonly string baseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? ""; +#endif public static string GetContent(string relativePath) { @@ -33,9 +27,11 @@ public static byte[] GetBytes(string relativePath) public static Stream GetStream(string relativePath) { +#if DEBUG var filePath = Path.Combine(baseDir, Path.GetFileName(relativePath)); if (File.Exists(filePath)) return File.OpenRead(filePath); +#endif var baseName = Assembly.GetExecutingAssembly().GetName().Name; var resourceName = relativePath