private void scanLibrary(String libraryName, String resourceNamePrefix, VirtualFile dir) {
Collection<VirtualFile> children = dir.getChildren();
for (VirtualFile child : children) {
String resourceName = resourceNamePrefix + child.getName();
if (child.isFile()) {
resources.add(new ResourceKey(resourceName, libraryName));
} else if (child.isDirectory()) {
VirtualFile resource = ResourceUtil.getLatestVersion(child, false);
if (resource != null) {
resources.add(new ResourceKey(resourceName, libraryName));
} else {
scanLibrary(libraryName, resourceName + "/", child);
}
}
}