diff --git a/ln.templates/html/FileSystemTemplateSource.cs b/ln.templates/html/FileSystemTemplateSource.cs
index 4bf1014..4878149 100644
--- a/ln.templates/html/FileSystemTemplateSource.cs
+++ b/ln.templates/html/FileSystemTemplateSource.cs
@@ -8,9 +8,15 @@ namespace ln.templates.html
public class FileSystemTemplateSource : ITemplateSource
{
public String BasePath { get; }
+ public bool Throws { get; }
Dictionary templateDocuments = new Dictionary();
+ public FileSystemTemplateSource(String path,bool throws)
+ :this(path)
+ {
+ Throws = throws;
+ }
public FileSystemTemplateSource(String path)
{
if (!Directory.Exists(path))
@@ -18,7 +24,8 @@ namespace ln.templates.html
BasePath = path;
}
- public TemplateDocument GetTemplateByPath(string path)
+ public TemplateDocument GetTemplateByPath(string path) => GetTemplateByPath(path, Throws);
+ public TemplateDocument GetTemplateByPath(string path,bool _throw)
{
string templatePath = Path.Combine(BasePath, path);
if (!File.Exists(templatePath))
@@ -26,7 +33,9 @@ namespace ln.templates.html
if (templateDocuments.ContainsKey(path))
templateDocuments.Remove(path);
- throw new FileNotFoundException();
+ if (_throw)
+ throw new FileNotFoundException();
+ return null;
}
if (!templateDocuments.TryGetValue(path,out TemplateDocument templateDocument))
diff --git a/ln.templates/ln.templates.csproj b/ln.templates/ln.templates.csproj
index 2305306..89fe3f2 100644
--- a/ln.templates/ln.templates.csproj
+++ b/ln.templates/ln.templates.csproj
@@ -4,7 +4,7 @@
netcoreapp3.1
- 0.1.0
+ 0.1.1
Harald Wolff-Thobaben
l--n.de
A simple templating system