BuildComponentUtilitiesGetRelativePath Method

This returns the path argument adjusted to be relative to the base path. Absolute path names will be returned unchanged.

Definition

Namespace: Sandcastle.Core.BuildAssembler
Assembly: Sandcastle.Core (in Sandcastle.Core.dll) Version: 2024.9.12.0
public static string GetRelativePath(
	this string path,
	string basePath
)

Parameters

path  String
The path to adjust including the filename
basePath  String
The base path to use including the filename

Return Value

String
The path argument as a path relative to the given base path

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type String. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

This assumes that the path separator is "/" and that both paths include a filename

Example

 
path:     "xxx/aaa/target.html"
basePath: "xxx/bbb/source.html"
result:   "../aaa/target.html"

See Also