Directory separator replacement uses path.replace(File.separatorChar, '/') (fixes #26)

This commit is contained in:
Sam Harwell
2013-08-21 11:07:15 -05:00
parent e091d4fe3d
commit 2cbe40a52b
4 changed files with 13 additions and 17 deletions

View File

@@ -454,7 +454,7 @@ public abstract class PDFMojo extends AbstractFoMojo {
File imageDirectory = getImageDirectory(); File imageDirectory = getImageDirectory();
File calloutDirectory = new File (imageDirectory, "callouts"); File calloutDirectory = new File (imageDirectory, "callouts");
transformer.setParameter("docbook.infile",sourceDocBook.getAbsolutePath().replaceAll("\\\\","/")); transformer.setParameter("docbook.infile",sourceDocBook.getAbsolutePath().replace(File.separatorChar, '/'));
transformer.setParameter("source.directory",sourceDirectory); transformer.setParameter("source.directory",sourceDirectory);
transformer.setParameter("compute.wadl.path.from.docbook.path",computeWadlPathFromDocbookPath); transformer.setParameter("compute.wadl.path.from.docbook.path",computeWadlPathFromDocbookPath);
@@ -506,7 +506,7 @@ public abstract class PDFMojo extends AbstractFoMojo {
//transformer.setParameter("docbook.infile",sourceDocBook.getAbsolutePath()); //transformer.setParameter("docbook.infile",sourceDocBook.getAbsolutePath());
String srcFilename = sourceDocBook.getName(); String srcFilename = sourceDocBook.getName();
getLog().info("SOURCE FOR COVER PAGE: "+this.projectBuildDirectory+"/docbkx/"+srcFilename); getLog().info("SOURCE FOR COVER PAGE: "+this.projectBuildDirectory+"/docbkx/"+srcFilename);
transformer.setParameter("docbook.infile", this.projectBuildDirectory.replaceAll("\\\\","/")+"/docbkx/"+srcFilename); transformer.setParameter("docbook.infile", this.projectBuildDirectory.replace(File.separatorChar, '/')+"/docbkx/"+srcFilename);
transformer.transform (new StreamSource(coverImageTemplate), new StreamResult(coverImage)); transformer.transform (new StreamSource(coverImageTemplate), new StreamResult(coverImage));
} }
catch (TransformerConfigurationException e) catch (TransformerConfigurationException e)
@@ -527,7 +527,7 @@ public abstract class PDFMojo extends AbstractFoMojo {
String pathToPipelineFile = "classpath:/pdf.xpl"; //use "classpath:/path" for this to work String pathToPipelineFile = "classpath:/pdf.xpl"; //use "classpath:/path" for this to work
String sourceFileNameNormalized = "file:///" + sourceFile.getAbsolutePath().replaceAll("\\\\","/"); String sourceFileNameNormalized = "file:///" + sourceFile.getAbsolutePath().replace(File.separatorChar, '/');
//from super //from super
final InputSource inputSource = new InputSource(sourceFileNameNormalized); final InputSource inputSource = new InputSource(sourceFileNameNormalized);
Source source = new SAXSource(filter, inputSource); Source source = new SAXSource(filter, inputSource);
@@ -543,7 +543,7 @@ public abstract class PDFMojo extends AbstractFoMojo {
String targetDirString = ""; String targetDirString = "";
try{ try{
targetDirString = this.getTargetDirectory().getParentFile().getCanonicalPath().replaceAll("\\\\","/"); targetDirString = this.getTargetDirectory().getParentFile().getCanonicalPath().replace(File.separatorChar, '/');
}catch(Exception e){ }catch(Exception e){
getLog().info("Exceptional!" + e); getLog().info("Exceptional!" + e);
} }

View File

@@ -748,7 +748,7 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
String pathToPipelineFile = "classpath:/webhelp.xpl"; //use "classpath:/path" for this to work String pathToPipelineFile = "classpath:/webhelp.xpl"; //use "classpath:/path" for this to work
String sourceFileNameNormalized = "file:///" + sourceFile.getAbsolutePath().replaceAll("\\\\","/"); String sourceFileNameNormalized = "file:///" + sourceFile.getAbsolutePath().replace(File.separatorChar, '/');
//from super //from super
final InputSource inputSource = new InputSource(sourceFileNameNormalized); final InputSource inputSource = new InputSource(sourceFileNameNormalized);
Source source = new SAXSource(filter, inputSource); Source source = new SAXSource(filter, inputSource);
@@ -765,7 +765,7 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
String targetDirString = ""; String targetDirString = "";
try{ try{
targetDirString = this.getTargetDirectory().getParentFile().getCanonicalPath().replaceAll("\\\\","/"); targetDirString = this.getTargetDirectory().getParentFile().getCanonicalPath().replace(File.separatorChar, '/');
}catch(Exception e){ }catch(Exception e){
getLog().info("Exceptional!" + e); getLog().info("Exceptional!" + e);
} }
@@ -853,7 +853,7 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
map.put("targetDir", baseDir.getAbsolutePath()+File.separator+"figures"); map.put("targetDir", baseDir.getAbsolutePath()+File.separator+"figures");
// String targetDirFiguresString = baseDir.getAbsolutePath()+File.separator+"figures"; // String targetDirFiguresString = baseDir.getAbsolutePath()+File.separator+"figures";
// map.put("targetDir", targetDirFiguresString.replaceAll("\\\\","/").replace("file:/", "file:///")); // map.put("targetDir", targetDirFiguresString.replace(File.separatorChar, '/').replace("file:/", "file:///"));
// getLog().info("~~~~~~~~FOOBAR~~~~~~~~~~~~~~~~:"); // getLog().info("~~~~~~~~FOOBAR~~~~~~~~~~~~~~~~:");
// getLog().info("~~~~~~~~baseDir:" + baseDir); // getLog().info("~~~~~~~~baseDir:" + baseDir);

View File

@@ -480,8 +480,8 @@ public class PDFBuilder {
// transformer.setParameter("docbook.infile", sourceFilePath); // transformer.setParameter("docbook.infile", sourceFilePath);
getLog().info("SOURCE FOR COVER PAGE: "+this.projectBuildDirectory.replaceAll("\\\\","/")+"/"+inputFilename); getLog().info("SOURCE FOR COVER PAGE: "+this.projectBuildDirectory.replace(File.separatorChar, '/')+"/"+inputFilename);
transformer.setParameter("docbook.infile", this.projectBuildDirectory.replaceAll("\\\\","/")+"/"+inputFilename); transformer.setParameter("docbook.infile", this.projectBuildDirectory.replace(File.separatorChar, '/')+"/"+inputFilename);
transformer.transform (new StreamSource(coverImageTemplate), new StreamResult(coverImage)); transformer.transform (new StreamSource(coverImageTemplate), new StreamResult(coverImage));
} }
@@ -1067,7 +1067,7 @@ public class PDFBuilder {
throws MojoExecutionException { throws MojoExecutionException {
String pathToPipelineFile = "classpath:/pdf.xpl"; //use "classpath:/path" for this to work String pathToPipelineFile = "classpath:/pdf.xpl"; //use "classpath:/path" for this to work
String sourceFileNameNormalized = "file:///" + sourceFile.getAbsolutePath().replaceAll("\\\\","/"); String sourceFileNameNormalized = "file:///" + sourceFile.getAbsolutePath().replace(File.separatorChar, '/');
//from super //from super
final InputSource inputSource = new InputSource(sourceFileNameNormalized); final InputSource inputSource = new InputSource(sourceFileNameNormalized);
Source source = new SAXSource(filter, inputSource); Source source = new SAXSource(filter, inputSource);

View File

@@ -1,5 +1,6 @@
package com.rackspace.cloud.api.docs.calabash.extensions; package com.rackspace.cloud.api.docs.calabash.extensions;
import java.io.File;
import java.net.URI; import java.net.URI;
import net.sf.saxon.s9api.QName; import net.sf.saxon.s9api.QName;
@@ -72,12 +73,7 @@ public class CopyAndTransformXProcStep extends DefaultStep {
URI uri = null; URI uri = null;
if (target != null) { if (target != null) {
uri = target.getBaseURI().resolve(FilenameUtils.normalizeNoEndSeparator(target.getString()).replace(File.separatorChar, '/'));
String targetFixed = FilenameUtils.normalizeNoEndSeparator(target.getString()).replaceAll("\\\\","/").replace("file:/", "file:///");
uri = target.getBaseURI().resolve(targetFixed);
uri = target.getBaseURI().resolve(FilenameUtils.normalizeNoEndSeparator(target.getString()));
} }
return uri; return uri;
@@ -87,7 +83,7 @@ public class CopyAndTransformXProcStep extends DefaultStep {
RuntimeValue target = getOption(_targetHtmlContentDir); RuntimeValue target = getOption(_targetHtmlContentDir);
URI uri = null; URI uri = null;
if (target != null) { if (target != null) {
uri = target.getBaseURI().resolve(target.getString().replaceAll("\\\\","/")); uri = target.getBaseURI().resolve(target.getString().replace(File.separatorChar, '/'));
} }
return uri; return uri;
} }