PathUtils.IsParentOf
This commit is contained in:
1 parent
0a3b21505a
commit
a1fcb5241a
6 files changed
+20
-18
No files matched your search
@@ -178,6 +178,15 @@ public static class PathUtils {
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 判断 <param name="parentPath"/> 是否为 <paramref name="childPath"/> 的父路径,或两者是否相同。
|
||||
/// </summary>
|
||||
public static bool IsParentOf(string parentPath, string childPath) {
|
||||
parentPath = PathUtils.ForCompare(parentPath);
|
||||
childPath = PathUtils.ForCompare(childPath);
|
||||
return childPath.StartsWithF(parentPath + @"\") || childPath == parentPath;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user