if ( folder == null) {
// look for template in working dir.
File file = new File(queryPath);
if (file.exists() && file.isFile()) {
try {
return new GTTemplateLocationReal(VirtualFile.open(file).relativePath(), file.toURI().toURL());
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
} else {
File file = new File ( folder, queryPath);
if (file.exists() && file.isFile()) {
try {
return new GTTemplateLocationReal(VirtualFile.open(file).relativePath(), file.toURI().toURL());
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
}
}
// try to find it directly on the app-root before we give up
VirtualFile tf = Play.getVirtualFile(queryPath);
if (tf != null && tf.exists() && !tf.isDirectory()) {
try {
return new GTTemplateLocationReal(tf.relativePath(), tf.getRealFile().toURI().toURL());
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}