fix jar path in windows

This commit is contained in:
wing328 2015-06-14 00:59:40 +08:00
parent 672fcd5a14
commit 7a560865a0
2 changed files with 3 additions and 3 deletions

View File

@ -60,10 +60,10 @@ public abstract class AbstractGenerator {
throw new RuntimeException("can't load template " + name);
}
private String getCPResourcePath(String name) {
public String getCPResourcePath(String name) {
if (!"/".equals(File.separator)) {
return name.replaceAll(Pattern.quote(File.separator), "/");
}
return name;
}
}
}

View File

@ -268,7 +268,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
// continue
}
if (in == null) {
in = this.getClass().getClassLoader().getResourceAsStream(config.templateDir() + File.separator + support.templateFile);
in = this.getClass().getClassLoader().getResourceAsStream(getCPResourcePath(config.templateDir() + File.separator + support.templateFile));
}
File outputFile = new File(outputFilename);
OutputStream out = new FileOutputStream(outputFile, false);