code: private void addItemsFromDir(BinaryResourcesHandler binRsHandler, String dirName, boolean addSubDirs) {
  		Set<String> resources = rsReaderHandler.getResourceNames(dirName);
  
  		if (LOGGER.isDebugEnabled()) {
  			LOGGER.debug("Adding " + resources.size() + " resources from path [" + dirName + "] to binary bundle");
  		}
  
  		GeneratorRegistry binGeneratorRegistry = binRsHandler.getConfig().getGeneratorRegistry();
  
  		List<String> folders = new ArrayList<>();
  		boolean generatedPath = binGeneratorRegistry.isPathGenerated(dirName);
  		for (String resourceName : resources) {
  			String resourcePath = PathNormalizer.joinPaths(dirName, resourceName, generatedPath);
  			if (hasBinaryFileExtension(resourceName)) {
  				addBinaryResourcePath(binRsHandler, resourcePath);
  
  				if (LOGGER.isDebugEnabled())
  					LOGGER.debug("Added to item path list:" + PathNormalizer.asPath(resourcePath));
  			} else if (addSubDirs) {
  
  				try {
  					if (rsReaderHandler.isDirectory(resourcePath)) {
  						folders.add(resourceName);
  					}
  				} catch (InvalidPathException e) {
  					if (LOGGER.isDebugEnabled())
  						LOGGER.debug("Enable to define if the following resource is a directory : "
  								+ PathNormalizer.asPath(resourcePath));
  				}
  			}
  		}
  
  		// Add subfolders if requested. Subfolders are added last unless
  		// specified in sorting file.
  		if (addSubDirs) {
  			for (String folderName : folders) {
  				addItemsFromDir(binRsHandler, PathNormalizer.joinPaths(dirName, folderName), true);
  			}
  		}
  	}
docs: Adds all the resources within a path to the image map.
  
  @param binRsHandler
  the binary resources handler
  @param dirName
  the directory name
  @param addSubDirs
  boolean If subfolders will be included. In such case, every
  folder below the path is included.