Method ExpandPath
ExpandPath(string, string)
Expands a relative path to an absolute path based on a provided root.
Declaration
public static string ExpandPath(string rootPath, string path)
Parameters
Type | Name | Description |
---|---|---|
string | rootPath | The root path. |
string | path | The relative path. |
Returns
Type | Description |
---|---|
string | The expanded path. |
Examples
ExpandPath("C:\\temp", "..\\file.txt"); //Returns "C:\\file.txt"
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when rootPath or path is null. |
FormatException | Thrown when invalid path is provided. |