protected Set<String> getTemplateNames() throws IOException {
if (resourceLoader != null && grailsApplication.isWarDeployed()) {
try {
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(resourceLoader);
return extractNames(resolver.getResources("/WEB-INF/templates/scaffolding/*.gsp"));
}
catch (Exception e) {
return Collections.emptySet();
}
}
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
Set<String> resources = new HashSet<String>();
String templatesDirPath = basedir + "/src/templates/scaffolding";
Resource templatesDir = new FileSystemResource(templatesDirPath);
if (templatesDir.exists()) {
try {
resources.addAll(extractNames(resolver.getResources("file:" + templatesDirPath + "/*.gsp")));
}
catch (Exception e) {
log.error("Error while loading views from " + basedir, e);
}
}
File pluginDir = getPluginDir();
try {
resources.addAll(extractNames(resolver.getResources("file:" + pluginDir + "/src/templates/scaffolding/*.gsp")));
}
catch (Exception e) {
// ignore
log.error("Error locating templates from " + pluginDir + ": " + e.getMessage(), e);
}