FilePath.AbsoluteToRelativePath Method

HTML to MAML Converter

FilePathAbsoluteToRelativePath Method
This helper method can be used to convert an absolute path to one that is relative to the given base path.

Namespace: SandcastleBuilder.Utils
Assembly: ConvertHtmlToMaml (in ConvertHtmlToMaml.exe) Version: 1.0.0.2
Syntax
public static string AbsoluteToRelativePath(
	string basePath,
	string absolutePath
)
Public Shared Function AbsoluteToRelativePath ( 
	basePath As String,
	absolutePath As String
) As String
public:
static String^ AbsoluteToRelativePath(
	String^ basePath, 
	String^ absolutePath
)
static member AbsoluteToRelativePath : 
        basePath : string * 
        absolutePath : string -> string 

Parameters

basePath
Type: SystemString
The base path
absolutePath
Type: SystemString
An absolute path

Return Value

Type: String
A path to the given absolute path that is relative to the given base path
Remarks
If the base path is null or empty, the current working folder is used.
Examples
string basePath = @"E:\DotNet\CS\TestProject\Source";
string absolutePath = @"E:\DotNet\CS\TestProject\Doc\Help.html";

string relativePath = FilePath.AbsoluteToRelativePath(basePath,
    absolutePath);

Console.WriteLine(relativePath);

// Results in: ..\Doc\Help.html
Dim basePath As String = "E:\DotNet\CS\TestProject\Source"
Dim absolutePath As String = "E:\DotNet\CS\TestProject\Doc\Help.html"

Dim relativePath As String = _
    FilePath.AbsoluteToRelativePath(basePath, absolutePath);

Console.WriteLine(relativePath)

' Results in: ..\Doc\Help.html

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

See Also