fix(win32): normalize backslash paths in config rel() and file ignore (#14903)
This commit is contained in:
parent
1af3e9e557
commit
1a0639e5b8
2 changed files with 4 additions and 3 deletions
|
|
@ -342,10 +342,11 @@ export namespace Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
function rel(item: string, patterns: string[]) {
|
function rel(item: string, patterns: string[]) {
|
||||||
|
const normalizedItem = item.replaceAll("\\", "/")
|
||||||
for (const pattern of patterns) {
|
for (const pattern of patterns) {
|
||||||
const index = item.indexOf(pattern)
|
const index = normalizedItem.indexOf(pattern)
|
||||||
if (index === -1) continue
|
if (index === -1) continue
|
||||||
return item.slice(index + pattern.length)
|
return normalizedItem.slice(index + pattern.length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ export namespace FileIgnore {
|
||||||
if (Glob.match(pattern, filepath)) return false
|
if (Glob.match(pattern, filepath)) return false
|
||||||
}
|
}
|
||||||
|
|
||||||
const parts = filepath.split(sep)
|
const parts = filepath.split(/[/\\]/)
|
||||||
for (let i = 0; i < parts.length; i++) {
|
for (let i = 0; i < parts.length; i++) {
|
||||||
if (FOLDERS.has(parts[i])) return true
|
if (FOLDERS.has(parts[i])) return true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue