Declaration
public static string ToggleRelative(
string basePath,
string toggledPath
)
Summary
Changes a relative
toggledPath to an absolute and vice versa, with respect to
basePath. Neither path must be an empty string. Any trailing slashes are ignored and the result won't
have one except for root "C:\"-style paths. Forward slashes, multiple repeated slashes, and any redundant "."
or ".." elements are correctly interpreted and eliminated. See Remarks for some special cases.
Parameters
string | basePath |
An absolute path to the directory which serves as the base for absolute/relative conversion. |
string | toggledPath |
An absolute or a relative path to be converted. |
Returns
The converted path.
Exceptions
- RT.Util.ToggleRelativeException
Conversion could not be performed for the reason specified in the exception object.
Remarks
Relative paths that specify a drive letter "C:thing" are not supported and result in undefined behaviour. If
the toggled path is relative then all ".." levels that expand beyond the root directory are silently
discarded.