dir_inside_of(): handle directory separators correctly

On Windows, both the forward slash and the backslash are directory
separators. Which means that `a\b\c` really is inside `a/b`. Therefore,
we need to special-case the directory separators in the helper function
`cmp_icase()` that is used in the loop in `dir_inside_of()`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin 2021-05-15 00:04:20 +02:00 коммит произвёл Victoria Dye
Родитель 2c3e5ea26e
Коммит 2e7edbbab1
1 изменённых файлов: 2 добавлений и 0 удалений

2
dir.c
Просмотреть файл

@ -3140,6 +3140,8 @@ static int cmp_icase(char a, char b)
{
if (a == b)
return 0;
if (is_dir_sep(a))
return is_dir_sep(b) ? 0 : -1;
if (ignore_case)
return toupper(a) - toupper(b);
return a - b;