Skip to content

Commit

Permalink
Making runtime folders case-insensitive and adding additional path check
Browse files Browse the repository at this point in the history
  • Loading branch information
soninaren authored and alrod committed Dec 5, 2017
1 parent ad4bed6 commit 11c8a8c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions AzureFunctions/Code/TemplatesManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,13 @@ private void HandleFileSystemChange()
var templateDirs = new List<string>();

foreach (var d in runtimeDirs)
{
templateDirs.AddRange(Directory.GetDirectories(Path.Combine(d, "Templates")));
{
string templatesDirectory = Path.Combine(d, "Templates");
if (Directory.Exists(templatesDirectory))
{
templateDirs.AddRange(Directory.GetDirectories(templatesDirectory));
}

}

IEnumerable<FunctionTemplate> templates = templateDirs.Select(GetFunctionTemplate).ToList();
Expand Down Expand Up @@ -128,9 +133,9 @@ public IEnumerable<FunctionTemplate> GetTemplates(string runtime)
{
try
{
return _templates.Any(t => t.Runtime == runtime)
? _templates.Where(t => t.Runtime == runtime)
: _templates.Where(t => t.Runtime == "default");
return _templates.Any(t => t.Runtime.ToLowerInvariant() == runtime.ToLowerInvariant())
? _templates.Where(t => t.Runtime.ToLowerInvariant() == runtime.ToLowerInvariant())
: _templates.Where(t => t.Runtime.ToLowerInvariant() == "default");
}
finally
{
Expand Down

0 comments on commit 11c8a8c

Please sign in to comment.