|
|
|
@ -132,7 +132,17 @@ export default class Application {
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
path(...parts: string[]) {
|
|
|
|
|
return path.resolve(this.root, ...parts)
|
|
|
|
|
let root = this.root
|
|
|
|
|
if ( root.startsWith('file://') ) {
|
|
|
|
|
root = root.slice(7)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const resolved = path.resolve(root, ...parts)
|
|
|
|
|
if ( resolved.startsWith('/') ) {
|
|
|
|
|
return `file://${resolved}`
|
|
|
|
|
} else {
|
|
|
|
|
return resolved
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -141,6 +151,16 @@ export default class Application {
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
app_path(...parts: string[]) {
|
|
|
|
|
return path.resolve(this.app_root, ...parts)
|
|
|
|
|
let app_root = this.app_root
|
|
|
|
|
if ( app_root.startsWith('file://') ) {
|
|
|
|
|
app_root = app_root.slice(7)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const resolved = path.resolve(app_root, ...parts)
|
|
|
|
|
if ( resolved.startsWith('/') ) {
|
|
|
|
|
return `file://${resolved}`
|
|
|
|
|
} else {
|
|
|
|
|
return resolved
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|