Get Relative Path(String, String) Method
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a relative path from one path to another.
public: static System::String ^ GetRelativePath(System::String ^ relativeTo, System::String ^ path);
public static string GetRelativePath (string relativeTo, string path);
static member GetRelativePath : string * string -> string
Public Shared Function GetRelativePath (relativeTo As String, path As String) As String
The source path the result should be relative to. This path is always considered to be a directory.
The destination path.
The relative path, or
path if the paths don't share the same root.
path is effectively empty.
Paths are resolved by calling the GetFullPath method before calculating the difference. The method uses the default file path comparison for the current platform (StringComparison.OrdinalIgnoreCase for Windows and MacOs, StringComparison.Ordinal for Linux.