From 71a5cbcd0b68b5983cc7d4cf0e17c037bc90048a Mon Sep 17 00:00:00 2001 From: Amruth Baskar Date: Tue, 2 Jul 2024 15:09:45 -0700 Subject: [PATCH 1/2] bug: same file names in different folder cause error --- src/YamlValidator/YamlLoader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/YamlValidator/YamlLoader.cs b/src/YamlValidator/YamlLoader.cs index 48bf81d2..035ead51 100644 --- a/src/YamlValidator/YamlLoader.cs +++ b/src/YamlValidator/YamlLoader.cs @@ -25,7 +25,7 @@ public IReadOnlyDictionary Load(string filePath, string pathType var yamlFiles = Directory.EnumerateFiles(filePath, "*" + Constants.YamlFileExtension, SearchOption.AllDirectories); foreach (var filename in yamlFiles) { - var fileName = Path.GetFileName(filename); + var fileName = Path.GetRelativePath(filePath, filename); var yamlText = Utility.ReadFileData(filename); deserializedYaml.Add(fileName, yamlText); } From 101ce1a086b4ff5aab15e5dc3562ef58c81475d3 Mon Sep 17 00:00:00 2001 From: Amruth Baskar Date: Wed, 3 Jul 2024 13:04:17 -0700 Subject: [PATCH 2/2] Change to full paths --- src/YamlValidator/YamlLoader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/YamlValidator/YamlLoader.cs b/src/YamlValidator/YamlLoader.cs index 035ead51..8e8d94e3 100644 --- a/src/YamlValidator/YamlLoader.cs +++ b/src/YamlValidator/YamlLoader.cs @@ -25,7 +25,7 @@ public IReadOnlyDictionary Load(string filePath, string pathType var yamlFiles = Directory.EnumerateFiles(filePath, "*" + Constants.YamlFileExtension, SearchOption.AllDirectories); foreach (var filename in yamlFiles) { - var fileName = Path.GetRelativePath(filePath, filename); + var fileName = Path.GetFullPath(filename); var yamlText = Utility.ReadFileData(filename); deserializedYaml.Add(fileName, yamlText); }