Skip to content

Commit 83e8a2e

Browse files
author
tao
committed
stop reading custom template file from subdirectories
1 parent 34fed26 commit 83e8a2e

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/AbstractGenerator.java

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -72,28 +72,20 @@ public Reader getTemplateReader(String name) {
7272
* @return String Full template file path
7373
*/
7474
public String getFullTemplateFile(CodegenConfig config, String templateFile) {
75-
String library = config.getLibrary();
76-
if (library != null && !"".equals(library)) {
77-
String libTemplateFile = config.templateDir() + File.separator +
78-
"libraries" + File.separator + library + File.separator +
79-
templateFile;
80-
81-
if (new File(libTemplateFile).exists()) {
82-
return libTemplateFile;
83-
}
84-
85-
libTemplateFile = config.embeddedTemplateDir() + File.separator +
86-
"libraries" + File.separator + library + File.separator +
87-
templateFile;
88-
if (embeddedTemplateExists(libTemplateFile)) {
89-
// Fall back to the template file embedded/packaged in the JAR file...
90-
return libTemplateFile;
91-
}
92-
}
9375
String template = config.templateDir() + File.separator + templateFile;
9476
if (new File(template).exists()) {
9577
return template;
9678
} else {
79+
String library = config.getLibrary();
80+
if (library != null && !"".equals(library)) {
81+
String libTemplateFile = config.embeddedTemplateDir() + File.separator +
82+
"libraries" + File.separator + library + File.separator +
83+
templateFile;
84+
if (embeddedTemplateExists(libTemplateFile)) {
85+
// Fall back to the template file embedded/packaged in the JAR file...
86+
return libTemplateFile;
87+
}
88+
}
9789
// Fall back to the template file embedded/packaged in the JAR file...
9890
return config.embeddedTemplateDir() + File.separator + templateFile;
9991
}

0 commit comments

Comments
 (0)