account for file:// when resolving app paths
This commit is contained in:
parent
a7d0f92da2
commit
f97a68b129
@ -132,7 +132,17 @@ export default class Application {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
path(...parts: 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
|
* @return string
|
||||||
*/
|
*/
|
||||||
app_path(...parts: 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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user