Firstborn/Library/PackageCache/com.unity.ide.vscode@1.2.5/Editor/ProjectGeneration/StringUtils.cs
Schaken-Mods b486678290 Library -Artifacts
Library -Artifacts
2023-03-28 12:24:16 -05:00

26 lines
802 B
C#

using System.IO;
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Unity.VSCode.EditorTests")]
namespace VSCodeEditor
{
internal static class StringUtils
{
private const char WinSeparator = '\\';
private const char UnixSeparator = '/';
public static string NormalizePath(this string path)
{
if (string.IsNullOrEmpty(path))
return path;
if (Path.DirectorySeparatorChar == WinSeparator)
path = path.Replace(UnixSeparator, WinSeparator);
if (Path.DirectorySeparatorChar == UnixSeparator)
path = path.Replace(WinSeparator, UnixSeparator);
return path.Replace(string.Concat(WinSeparator, WinSeparator), WinSeparator.ToString());
}
}
}