Merge pull request #3628 from topecongiro/issue-3627

Fix is_subpath
This commit is contained in:
Stéphane Campinas 2019-06-14 14:07:07 +02:00 committed by GitHub
commit 4b102fde2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,7 +66,11 @@ where
P: AsRef<Path>,
{
(0..path.components().count())
.map(|i| path.components().take(i))
.map(|i| {
path.components()
.skip(i)
.take(subpath.as_ref().components().count())
})
.any(|c| c.zip(subpath.as_ref().components()).all(|(a, b)| a == b))
}