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.UtilsAssembly: SandcastleBuilder.Utils (in SandcastleBuilder.Utils.dll) Version: 2024.12.21.0
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
- basePath String
- The base path
- absolutePath String
- An absolute path
StringA path to the given absolute path that is relative to the given base path
If the base path is null or empty, the current working folder is used.
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.