Skip to content

Commit

Permalink
simplify GetRelativePath
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Jan 19, 2023
1 parent 826094d commit 9d0bcad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Verify/IoHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,9 @@ public static Task WriteText(string path, StringBuilder text)
public static string GetRelativePath(string directory, string file)
{
var fullPath = Path.Combine(directory, file);
if (directory.EndsWith(Path.DirectorySeparatorChar) ||
directory.EndsWith(Path.AltDirectorySeparatorChar))
var last = directory[^1];
if (last == Path.DirectorySeparatorChar ||
last == Path.AltDirectorySeparatorChar)
{
return fullPath[directory.Length..];
}
Expand Down

0 comments on commit 9d0bcad

Please sign in to comment.