Brak opisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GetRelativePath.cs 724B

1234567891011121314151617181920212223242526
  1. using System;
  2. using UnityEngine;
  3. namespace Unity.PlasticSCM.Editor
  4. {
  5. internal static class GetRelativePath
  6. {
  7. internal static string ToApplication(string path)
  8. {
  9. Uri relativeToUri = new Uri(ApplicationDataPath.Get());
  10. Uri pathUri = new Uri(FixVolumeLetterPath(path));
  11. return Uri.UnescapeDataString(
  12. relativeToUri.MakeRelativeUri(pathUri).ToString());
  13. }
  14. static string FixVolumeLetterPath(string path)
  15. {
  16. string volumeLetter = new string(new char[] { path[0] });
  17. volumeLetter = volumeLetter.ToUpperInvariant();
  18. return string.Concat(volumeLetter, path.Substring(1));
  19. }
  20. }
  21. }