public static string GetRelativeDirectory(this IAbsoluteDirectoryPath path, IAbsoluteDirectoryPath possibleRoot) { if (path.Equals(possibleRoot) || !path.CanGetRelativePathFrom(possibleRoot) || !path.IsRootedIn(possibleRoot)) { return(path.ToString()); } return(path.GetRelativePathFrom(possibleRoot).Join()); }