protected void copyDirectory()

in src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java [180:209]


    protected void copyDirectory(final File source, final File target, final String[] includes, final String[] excludes)
    throws IOException {
        final String prefix = source.getAbsolutePath() + File.separatorChar;
        final int prefixLength = prefix.length();
        org.apache.commons.io.FileUtils.copyDirectory(source, target, new FileFilter() {

            public boolean accept(final File file) {
                final String path = file.getAbsolutePath().substring(prefixLength).replace(File.separatorChar, '/');
                if ( includes != null ) {
                    boolean matched = false;
                    for(int i = 0; i<includes.length && !matched; i++) {
                        if ( SelectorUtils.matchPath(includes[i], path)) {
                            matched = true;
                        }
                    }
                    if ( !matched ) {
                        return false;
                    }
                }
                if ( excludes != null ) {
                    for(final String pattern:excludes) {
                        if ( SelectorUtils.matchPath(pattern, path)) {
                            return false;
                        }
                    }
                }
                return true;
            }
        });
    }