In System.IO, Path.GetRelativePath(pathstr1, pathstr2) doesn't require that pathstr2 is inside pathstr1
using System.IO;
string pathstr1 = "E:/a";
string pathstr2 = "E:/a/b";
Console.WriteLine(Path.GetRelativePath(pathstr1, pathstr2)); // "b"
Console.WriteLine(Path.GetRelativePath(pathstr1, pathstr1)); // "."
Console.WriteLine(Path.GetRelativePath(pathstr2, pathstr1)); // ".."
However, In PathLib, running path2.RelativeTo(path1) when path2 isn't inside path1 will throw an error:
using PathLib;
IPath path1 = Paths.Create("E:/a");
IPath path2 = Paths.Create("E:/a/b");
Console.WriteLine(path2.RelativeTo(path1)); // "b"
Console.WriteLine(path1.RelativeTo(path1)); // error
Console.WriteLine(path1.RelativeTo(path2)); // error