Singularity/Library/PackageCache/com.unity.collab-proxy@2.0.3/Editor/PlasticSCM/GetRelativePath.cs

27 lines
724 B
C#
Raw Permalink Normal View History

2024-05-06 14:45:45 -04:00
using System;
using UnityEngine;
namespace Unity.PlasticSCM.Editor
{
internal static class GetRelativePath
{
internal static string ToApplication(string path)
{
Uri relativeToUri = new Uri(ApplicationDataPath.Get());
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));
}
}
}