Skip to content

Commit

Permalink
Remove local path discovery for AOT support
Browse files Browse the repository at this point in the history
Keep it only for debug versions since it's useful when locally tweaking the templates during development.

Fixes #279
  • Loading branch information
kzu committed Jan 30, 2024
1 parent 8fa1fba commit ea9c116
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/EmbeddedResource.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

// <auto-generated />
using System;
using System.IO;
using System.Linq;
using System.Reflection;

static class EmbeddedResource
{
#if DEBUG
static readonly string baseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? "";
#endif

public static string GetContent(string relativePath)
{
Expand All @@ -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
Expand Down

0 comments on commit ea9c116

Please sign in to comment.