String bookName = Utilities.toDirectoryName(null, book.getName());
File bookRoot = new File(outputFolder, bookName);
try {
File templateIncludes = new File(templateDir, "includes/");
if (!templateIncludes.exists()) {
throw new TubainaException("Could not find includes dir at: " + templateIncludes.getAbsolutePath() + ".");
}
NotFileFilter excludingVersionControlFiles = new NotFileFilter(new NameFileFilter(Arrays.asList("CVS", ".svn", ".git")));
FileUtilities.copyDirectoryToDirectory(templateIncludes, bookRoot, excludingVersionControlFiles);
} catch (IOException e) {
throw new TubainaException("Error while copying template files", e);
}
return new TubainaHtmlDir(bookRoot, templateDir, resourceManipulatorFactory);
}