public Enumeration getEntryPaths()

in core/src/main/java/org/apache/sling/testing/mock/osgi/MockBundle.java [142:170]


    public Enumeration<String> getEntryPaths(final String path) {

        String queryPath = path.startsWith("/") ? path : "/" + path;

        URL res = getClass().getResource(queryPath);
        if ( res == null ) {
            return null;
        }

        List<String> matching = new ArrayList<>();

        try {
            File file = new File(res.toURI());
            if ( file.isDirectory()) {
                for ( File entry : file.listFiles() ) {
                    String name = entry.isDirectory() ? entry.getName() + "/" : entry.getName();
                    matching.add(relativeWithTrailingSlash(queryPath.substring(1, queryPath.length())) + name);
                }
            }
        } catch (URISyntaxException | RuntimeException e) {
            throw new RuntimeException("Failed opening file from " + res , e);
        }

        if ( matching.isEmpty() ) {
            return null;
        }

        return Collections.enumeration(matching);
    }