mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-05-16 08:31:26 +00:00
Merge pull request #2635 from wing328/template_folder_exception
Add exception handling for template directory that does not exist
This commit is contained in:
@@ -148,7 +148,14 @@ public class CodegenConfigurator {
|
||||
}
|
||||
|
||||
public CodegenConfigurator setTemplateDir(String templateDir) {
|
||||
this.templateDir = new File(templateDir).getAbsolutePath();
|
||||
File f = new File(templateDir);
|
||||
|
||||
// check to see if the folder exists
|
||||
if (!(f != null && f.exists() && f.isDirectory())) {
|
||||
throw new IllegalArgumentException("Template directory " + templateDir + " does not exist.");
|
||||
}
|
||||
|
||||
this.templateDir = f.getAbsolutePath();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user