mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 19:33:55 +00:00
Merge pull request #867 from wing328/fix_jar_path
[Bug fix] Fix path inside JAR for non-template files
This commit is contained in:
commit
f66b5cf65b
@ -60,7 +60,7 @@ 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), "/");
|
||||
}
|
||||
|
@ -268,11 +268,12 @@ 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);
|
||||
if (in != null && out != null) {
|
||||
System.out.println("writing file " + outputFile);
|
||||
IOUtils.copy(in, out);
|
||||
} else {
|
||||
if (in == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user