in src/Tasks/Microsoft.NET.Build.Tasks/ResolveToolPackagePaths.cs [63:102]
private static string NormalizeDirectorySeparatorsToUnixStyle(string path)
{
if (string.IsNullOrEmpty(path))
{
return path;
}
char current;
StringBuilder builder = new StringBuilder(path.Length);
int start = 0;
if (IsDirectorySeparator(path[start]))
{
start++;
builder.Append(BackwardSeparatorChar);
}
for (int i = start; i < path.Length; i++)
{
current = path[i];
// If we have a separator
if (IsDirectorySeparator(current))
{
// If the next is a separator, skip adding this
if (i + 1 < path.Length && IsDirectorySeparator(path[i + 1]))
{
continue;
}
// Ensure it is the primary separator
current = BackwardSeparatorChar;
}
builder.Append(current);
}
return builder.ToString();
}