From b2c3a5d108757eb410f0bb024b4094d027a40380 Mon Sep 17 00:00:00 2001 From: tsrk Date: Thu, 6 Jul 2023 09:30:58 +0200 Subject: [PATCH] style: use safer and readable code for `Path.Join` Turns out this PR broke behaviour between Windows 10 and Windows 11 for some reason. Not tested on other platforms but this is definitely safer than just relying on an error-prone assumption. Co-authored-by: Dean Herbert --- LocalisationAnalyser.Tools/Program.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/LocalisationAnalyser.Tools/Program.cs b/LocalisationAnalyser.Tools/Program.cs index baad336..69411ed 100644 --- a/LocalisationAnalyser.Tools/Program.cs +++ b/LocalisationAnalyser.Tools/Program.cs @@ -92,8 +92,12 @@ private static async Task projectToResX(FileInfo projectFile, DirectoryInfo? out localisationFile = await LocalisationFile.ReadAsync(stream); string targetDirectory = output != null ? output.FullName : Path.GetDirectoryName(file.FilePath)!; + if (file.Folders.Count > 1) - targetDirectory += string.Join(Path.DirectorySeparatorChar, file.Folders.Skip(1)); + { + string subNamespaceDirectory = Path.Join(file.Folders.Skip(1).ToArray()); + targetDirectory = Path.Join(targetDirectory, subNamespaceDirectory); + } string targetFileName = localisationFile.Prefix[(localisationFile.Prefix.LastIndexOf('.') + 1)..]; string resxFile = Path.Combine(targetDirectory, $"{targetFileName}.resx");