Skip to content

Commit

Permalink
style: use safer and readable code for Path.Join
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ItsShamed and peppy committed Jul 6, 2023
1 parent fb94b62 commit b2c3a5d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion LocalisationAnalyser.Tools/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit b2c3a5d

Please sign in to comment.