mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-06 06:38:20 +00:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user