forked from MapComplete/MapComplete
Fix: deal with dashes in the path
This commit is contained in:
parent
e8e4ae1f47
commit
5127609120
1 changed files with 4 additions and 4 deletions
|
@ -1524,7 +1524,7 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
|
||||||
const error = new Error("No error")
|
const error = new Error("No error")
|
||||||
const stack = error.stack.split("\n")
|
const stack = error.stack.split("\n")
|
||||||
stack.shift() // Remove "Error: No error"
|
stack.shift() // Remove "Error: No error"
|
||||||
const regex = /at (.*) \(([a-zA-Z0-9/.]+):([0-9]+):([0-9]+)\)/
|
const regex = /at (.*) \(([a-zA-Z0-9-/.]+):([0-9]+):([0-9]+)\)/
|
||||||
const stackItem = stack[Math.abs(offset) + 1]
|
const stackItem = stack[Math.abs(offset) + 1]
|
||||||
|
|
||||||
let functionName: string
|
let functionName: string
|
||||||
|
@ -1534,10 +1534,10 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
|
||||||
let _: string
|
let _: string
|
||||||
const matchWithFuncName = stackItem.match(regex)
|
const matchWithFuncName = stackItem.match(regex)
|
||||||
if (matchWithFuncName) {
|
if (matchWithFuncName) {
|
||||||
;[_, functionName, path, line, column] = matchWithFuncName
|
[_, functionName, path, line, column] = matchWithFuncName
|
||||||
} else {
|
} else {
|
||||||
const regexNoFuncName: RegExp = new RegExp("at ([a-zA-Z0-9/.]+):([0-9]+):([0-9]+)")
|
const regexNoFuncName: RegExp = new RegExp("at ([a-zA-Z0-9-/.]+):([0-9]+):([0-9]+)");
|
||||||
;[_, path, line, column] = stackItem.match(regexNoFuncName)
|
[_, path, line, column] = stackItem.match(regexNoFuncName)
|
||||||
}
|
}
|
||||||
|
|
||||||
const markdownLocation = path.substring(path.indexOf("MapComplete/src") + 11) + "#L" + line
|
const markdownLocation = path.substring(path.indexOf("MapComplete/src") + 11) + "#L" + line
|
||||||
|
|
Loading…
Reference in a new issue