Fix #6495 - Handle starting separator during name comparison

During the loop comparing file/directory names, the starting character
in both will be a path separator in most cases.
Since a naive string equality will regard forward slashes and
backslashes as different, we must specially handle the first character
and exclude it from the equality comparison if necessary.
This commit is contained in:
imp0s5ible
2026-03-29 21:11:22 +02:00
parent d8aa2f3ad0
commit 1f2d978396

View File

@@ -349,6 +349,9 @@ _get_common_path_len :: proc(base, target: string) -> int {
end := min(len(base), len(target))
for j in 0..=end {
if j == end || _is_path_separator(base[j]) {
if _is_path_separator(base[i]) && _is_path_separator(target[i]) {
i += 1
}
if strings.equal_fold(base[i:j], target[i:j]) {
i = j
} else {