I want to know programmatically if a view or a layout exists in grails.
I am thinking in obtain the absolutepath and ask for File.exists but I don\'t know how to obt
I see 2 possibilities
If you build a war file you will see that views are stored in WEB-INF/grails-app/views. You can search for that resource.
def uri = this.getClass().getResource("/grails-app/views/...").toURI()
if(new File(uri).exists()){...}
Find a inspiration in assertView method of GrailsUrlMappingsTestCase.
def patternResolver = new PathMatchingResourcePatternResolver()
def pathPattern = "grails-app/views/" + ((controller) ? "$controller/" : "") + "${view}.*"
if (!patternResolver.getResources(pathPattern)) {...}