|
|
|
@ -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
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|