Search in sources :

Example 1 with DefaultFileTreeElement

use of org.gradle.api.internal.file.DefaultFileTreeElement in project gradle by gradle.

the class DirectoryTrees method contains.

public static boolean contains(FileSystem fileSystem, DirectoryTree tree, File file) {
    String prefix = tree.getDir().getAbsolutePath() + File.separator;
    if (!file.getAbsolutePath().startsWith(prefix)) {
        return false;
    }
    RelativePath path = RelativePath.parse(true, file.getAbsolutePath().substring(prefix.length()));
    return tree.getPatterns().getAsSpec().isSatisfiedBy(new DefaultFileTreeElement(file, path, fileSystem, fileSystem));
}
Also used : RelativePath(org.gradle.api.file.RelativePath) DefaultFileTreeElement(org.gradle.api.internal.file.DefaultFileTreeElement)

Aggregations

RelativePath (org.gradle.api.file.RelativePath)1 DefaultFileTreeElement (org.gradle.api.internal.file.DefaultFileTreeElement)1