Navigation
API > API/Runtime > API/Runtime/Core > API/Runtime/Core/FPathViews
Description
Check whether Parent is a parent path of Child and report the relative path if so. Case-insensitive / is treated as equal to \ Presence or absence of terminating separator (/) is ignored in the comparison. Directory elements of . and .. are currently not interpreted and are treated as literal characters. Callers should not rely on this behavior as it may be corrected in the future. callers should instead conform the paths before calling. Relative paths and absolute paths are not resolved, and relative paths will never equal absolute paths. Callers should not rely on this behavior as it may be corrected in the future; callers should instead conform the paths before calling. Examples: ("../A/B", "../A") -> (true, "B") ("../A\B", "../A/") -> (true, "B") ("../A/", "../A") -> (true, "") (".././A/", "../A") -> (false, "") ("../../../Engine", "d:/root/Engine") -> (false, "")
| Name | TryMakeChildPathRelativeTo |
| Type | function |
| Header File | /Engine/Source/Runtime/Core/Public/Misc/PathViews.h |
| Include Path | #include "Misc/PathViews.h" |
| Source | /Engine/Source/Runtime/Core/Private/Misc/PathViews.cpp |
static bool TryMakeChildPathRelativeTo
(
FStringView Child,
FStringView Parent,
FStringView & OutRelPath
)
True if and only if Child is a child path of Parent (or is equal to it).
Parameters
| Name | Remarks |
|---|---|
| Child | An absolute path that may be a child path of Parent. |
| Parent | An absolute path that may be a parent path of Child. |
| OutRelPath | Receives the relative path from Parent to Child, or empty if Parent is not a parent of Child. |