in doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java [802:863]
public void copyResources(SiteRenderingContext siteRenderingContext, File outputDirectory) throws IOException {
ZipFile file = getZipFile(siteRenderingContext.getSkin().getFile());
try {
for (Enumeration<? extends ZipEntry> e = file.entries(); e.hasMoreElements(); ) {
ZipEntry entry = e.nextElement();
if (!entry.getName().startsWith("META-INF/")) {
File destFile = new File(outputDirectory, entry.getName());
if (!entry.isDirectory()) {
if (destFile.exists()) {
// don't override existing content: avoids extra rewrite with same content or extra site
// resource
continue;
}
destFile.getParentFile().mkdirs();
copyFileFromZip(file, entry, destFile);
} else {
destFile.mkdirs();
}
}
}
} finally {
closeZipFile(file);
}
// Copy extra site resources
for (SiteDirectory siteDirectory : siteRenderingContext.getSiteDirectories()) {
File resourcesDirectory = new File(siteDirectory.getPath(), "resources");
if (resourcesDirectory != null && resourcesDirectory.exists()) {
copyDirectory(resourcesDirectory, outputDirectory);
}
}
// Check for the existence of /css/site.css
File siteCssFile = new File(outputDirectory, "/css/site.css");
if (!siteCssFile.exists()) {
// Create the subdirectory css if it doesn't exist, DOXIA-151
File cssDirectory = new File(outputDirectory, "/css/");
boolean created = cssDirectory.mkdirs();
if (created && LOGGER.isDebugEnabled()) {
LOGGER.debug("The directory '" + cssDirectory.getAbsolutePath() + "' did not exist. It was created.");
}
// If the file is not there - create an empty file, DOXIA-86
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"The file '" + siteCssFile.getAbsolutePath() + "' does not exist. Creating an empty file.");
}
Writer writer = null;
try {
writer = WriterFactory.newWriter(siteCssFile, siteRenderingContext.getOutputEncoding());
// DOXIA-290...the file should not be 0 bytes.
writer.write("/* You can override this file with your own styles */");
} finally {
IOUtil.close(writer);
}
}
}