throw new BuildException(String.format("Cannot write to file '%s': %s", tocOutputFile, e.getMessage()), //$NON-NLS-1$
e);
}
try {
MarkupToEclipseToc toEclipseToc = new SplittingMarkupToEclipseToc();
toEclipseToc.setHelpPrefix(helpPrefix);
System.out.println("Help: " + baseDir + " " + htmlOutputFile); //$NON-NLS-1$//$NON-NLS-2$
toEclipseToc.setBookTitle(title == null ? name : title);
String basePath = baseDir.getAbsolutePath().replace('\\', '/');
String outputFilePath = htmlOutputFile.getAbsolutePath().replace('\\', '/');
if (outputFilePath.startsWith(basePath)) {
String filePath = outputFilePath.substring(basePath.length());
if (filePath.startsWith("/")) { //$NON-NLS-1$
filePath = filePath.substring(1);
}
if (filePath.lastIndexOf('/') != -1) {
String relativePart = filePath.substring(0, filePath.lastIndexOf('/'));
toEclipseToc.setHelpPrefix(helpPrefix == null ? relativePart : helpPrefix + '/' + relativePart);
}
}
toEclipseToc.setHtmlFile(htmlOutputFile.getName());
String tocXml = toEclipseToc.createToc(item);
try {
writer.write(tocXml);
} catch (Exception e) {
throw new BuildException(String.format("Cannot write to file '%s': %s", tocXml, e.getMessage()), e); //$NON-NLS-1$