PathHelper.EnsureValidRelativePath Method

Namespace
Kampute.DocToolkit.Support
Assembly
  • Kampute.DocToolkit.dll

Definition

Validates the specified path to ensure it is a relative path and does not contain invalid characters.
public static string EnsureValidRelativePath(string path, string caller = "")

Parameters

path string
The path to validate.
caller string optional
The name of the caller member.

Returns

string
The validated path where backslashes are replaced with forward slashes and trailing slashes are removed.

Exceptions

ArgumentException
Thrown when the path is not relative.
Thrown when the path contains invalid characters.