use of com.eden.orchid.api.resources.resource.JarResource in project Orchid by JavaEden.
the class DefaultResourceSource method getResourceEntries.
@Override
public List<OrchidResource> getResourceEntries(String path, String[] fileExtensions, boolean recursive) {
List<OrchidResource> entries = new ArrayList<>();
JarFile jarFile = jarForClass(this.getClass());
if (jarFile == null) {
return entries;
}
Enumeration<JarEntry> jarEntries = jarFile.entries();
while (jarEntries.hasMoreElements()) {
JarEntry jarEntry = jarEntries.nextElement();
// we are checking a file in the jar
if (OrchidUtils.normalizePath(jarEntry.getName()).startsWith(path + "/") && !jarEntry.isDirectory()) {
if (EdenUtils.isEmpty(fileExtensions) || FilenameUtils.isExtension(jarEntry.getName(), fileExtensions)) {
if (shouldAddEntry(jarEntry.getName())) {
entries.add(new JarResource(context, jarFile, jarEntry));
}
}
}
}
return entries;
}
Aggregations