Fix view engine path resolution
This commit is contained in:
parent
dd38b2cda7
commit
642319ef1f
@ -95,7 +95,15 @@ export default class ViewEngine extends LifecycleUnit {
|
|||||||
*/
|
*/
|
||||||
public template_path(...parts: string[]): string {
|
public template_path(...parts: string[]): string {
|
||||||
if ( !this.template_dir ) throw new MissingTemplateDirectoryError()
|
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…
Reference in New Issue
Block a user