Skip to content

Commit 11c8a8c

Browse files
soninarenalrod
authored andcommitted
Making runtime folders case-insensitive and adding additional path check
1 parent ad4bed6 commit 11c8a8c

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

AzureFunctions/Code/TemplatesManager.cs

+10-5
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,13 @@ private void HandleFileSystemChange()
6565
var templateDirs = new List<string>();
6666

6767
foreach (var d in runtimeDirs)
68-
{
69-
templateDirs.AddRange(Directory.GetDirectories(Path.Combine(d, "Templates")));
68+
{
69+
string templatesDirectory = Path.Combine(d, "Templates");
70+
if (Directory.Exists(templatesDirectory))
71+
{
72+
templateDirs.AddRange(Directory.GetDirectories(templatesDirectory));
73+
}
74+
7075
}
7176

7277
IEnumerable<FunctionTemplate> templates = templateDirs.Select(GetFunctionTemplate).ToList();
@@ -128,9 +133,9 @@ public IEnumerable<FunctionTemplate> GetTemplates(string runtime)
128133
{
129134
try
130135
{
131-
return _templates.Any(t => t.Runtime == runtime)
132-
? _templates.Where(t => t.Runtime == runtime)
133-
: _templates.Where(t => t.Runtime == "default");
136+
return _templates.Any(t => t.Runtime.ToLowerInvariant() == runtime.ToLowerInvariant())
137+
? _templates.Where(t => t.Runtime.ToLowerInvariant() == runtime.ToLowerInvariant())
138+
: _templates.Where(t => t.Runtime.ToLowerInvariant() == "default");
134139
}
135140
finally
136141
{

0 commit comments

Comments
 (0)