I'm looking to achieve something like
if (basePath.contains(subPath)) {
// subPath is a subPath of the basePath
}
I know I could achieve this by traversing the subPath
's parents, checking for basePath
on the way.
Is there an std
method for this?
std::filesystem::path("/a/b/").contains("/a/b/c/d") == true
subPath.compare(0, basePath.size(), basePath) == 0
might do the trick.contains()
should be more likestartwith()
)