Fix view engine path resolution

master
Garrett Mills 4 years ago
parent dd38b2cda7
commit 642319ef1f
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246

@ -95,7 +95,15 @@ export default class ViewEngine extends LifecycleUnit {
*/
public template_path(...parts: string[]): string {
if ( !this.template_dir ) throw new MissingTemplateDirectoryError()
return path.resolve(this.template_dir, ...parts)
let template_dir = this.template_dir
if ( template_dir.startsWith('file://') ) template_dir = template_dir.slice(7)
const resolved_path = path.resolve(template_dir, ...parts)
if ( resolved_path.startsWith('/') ) {
return `file://${resolved_path}`
} else {
return resolved_path
}
}
/**

Loading…
Cancel
Save