Template template = null;
for (VirtualFile vf : Play.templatesPath) {
if (vf == null) {
continue;
}
VirtualFile tf = vf.child(path);
if (tf.exists()) {
template = TemplateLoader.load(tf);
break;
}
}
/*
if (template == null) {
//When using the old 'key = (file.relativePath().hashCode() + "").replace("-", "M");',
//the next line never return anything, since all values written to templates is using the
//above key.
//when using just file.relativePath() as key, the next line start returning stuff..
//therefor I have commented it out.
template = templates.get(path);
}
*/
//TODO: remove ?
if (template == null) {
VirtualFile tf = Play.getVirtualFile(path);
if (tf != null && tf.exists()) {
template = TemplateLoader.load(tf);
} else {
throw new TemplateNotFoundException(path);
}
}