public static Iterable<FileEntry> listFilesRelativeToClass(Class<?> clazz, String subdirectory) throws IOException {
        ArrayList<FileEntry> list = new ArrayList<FileEntry>();
        CodeSource src = clazz.getProtectionDomain().getCodeSource();
        if (src == null) {
            return list;
        }
        URL classpathEntry = src.getLocation();
        try {
            // Check if we're loaded from a folder
            File file = new File(new File(classpathEntry.toURI()), subdirectory);
            if (file.isDirectory()) {
                return fileEntriesFor(file.listFiles());
            }
        } catch (URISyntaxException e) {
            // Should never happen, because we know classpathentry is valid
            throw new RuntimeException(e);
        }

        // We're not in a folder, so we must be in a jar or similar
        subdirectory = subdirectory.replace(File.separatorChar, '/');
        if (!subdirectory.endsWith("/")) {
            subdirectory = subdirectory + "/";
        }

        ZipInputStream jarStream = new ZipInputStream(classpathEntry.openStream());
        ZipEntry zipEntry;
        while ((zipEntry = jarStream.getNextEntry()) != null) {
            if (isChild(subdirectory, zipEntry.getName())) {
                String basename = zipEntry.getName().substring(subdirectory.length());
                int indexOfSlash = basename.indexOf('/');
                if (indexOfSlash < 0 || indexOfSlash == basename.length() - 1) {
                    list.add(new FileEntry(basename));
                }
            }
        }
        return list;
    }