Summary
Checks if a path is a sub path of another path.
The comparison is case-insensitive, handles /
and \
slashes as folder separators and
only matches if the base dir folder name is matched exactly
(c:\foobar\file.txt
is not a sub path of c:\foo
).
Syntax
public static bool IsSubpathOf(this string path, string baseDirPath)
Parameters
Name |
Type |
Description |
path |
string |
Full path which should be checked if it is a sub path. |
baseDirPath |
string |
Path for which should be checked if pathis a sub path of. |
Return Value
Type |
Description |
bool |
Returns true if path starts with the path baseDirPath. |