SW-Wiktor-Bombola/SW-Unity/Library/PackageCache/com.unity.collab-proxy@1.10.2/Editor/PlasticSCM/GetRelativePath.cs
2021-12-04 15:15:29 +01:00

27 lines
719 B
C#

using System;
using UnityEngine;
namespace Unity.PlasticSCM.Editor
{
internal static class GetRelativePath
{
internal static string ToApplication(string path)
{
Uri relativeToUri = new Uri(Application.dataPath);
Uri pathUri = new Uri(FixVolumeLetterPath(path));
return Uri.UnescapeDataString(
relativeToUri.MakeRelativeUri(pathUri).ToString());
}
static string FixVolumeLetterPath(string path)
{
string volumeLetter = new string(new char[] { path[0] });
volumeLetter = volumeLetter.ToUpperInvariant();
return string.Concat(volumeLetter, path.Substring(1));
}
}
}