Build Component UtilitiesGet Relative Path 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: 2026.1.20.0
The path argument as a path relative to the given base path
Assembly: Sandcastle.Core (in Sandcastle.Core.dll) Version: 2026.1.20.0
C#
public static string GetRelativePath(
this string path,
string basePath
)VB
<ExtensionAttribute>
Public Shared Function GetRelativePath (
path As String,
basePath As String
) As StringC++
public:
[ExtensionAttribute]
static String^ GetRelativePath(
String^ path,
String^ basePath
)F#
[<ExtensionAttribute>]
static member GetRelativePath :
path : string *
basePath : string -> string Parameters
- path String
- The path to adjust including the filename
- basePath String
- The base path to use including the filename
Return Value
StringThe 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"