Click or drag to resize
Sandcastle Help File BuilderFilePathAbsoluteToRelativePath 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: SandcastleBuilder.Utils (in SandcastleBuilder.Utils.dll) Version: 2014.11.22.0
Syntax
public static string AbsoluteToRelativePath(
	string basePath,
	string absolutePath
)

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
See Also