Merge pull request #2635 from wing328/template_folder_exception

Add exception handling for template directory that does not exist
This commit is contained in:
wing328
2016-04-19 16:28:24 +08:00

View File

@@ -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;
}