forked from MapComplete/MapComplete
chore: automated housekeeping...
This commit is contained in:
parent
d3b6c090f3
commit
332f960f86
57 changed files with 2884 additions and 1972 deletions
|
@ -285,13 +285,13 @@ export default class ScriptUtils {
|
|||
*/
|
||||
static detectVariablePaths(path: string) {
|
||||
const splitPath = path.match(/(.*)\{(.+)\}(.*)/)
|
||||
if(!splitPath){
|
||||
return [path]
|
||||
if (!splitPath) {
|
||||
return [path]
|
||||
}
|
||||
const [_, head] = splitPath
|
||||
const headPath = head.slice(0, head.lastIndexOf("/"))
|
||||
const allPossibleMatchingFiles = ScriptUtils.readDirRecSync(headPath)
|
||||
const pathAsRegex = path.replaceAll(/\{.+}/g, ".+")
|
||||
return allPossibleMatchingFiles.filter(pth => pth.match(pathAsRegex))
|
||||
return allPossibleMatchingFiles.filter((pth) => pth.match(pathAsRegex))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue