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
Родитель 2d3cff3b9a
Коммит 0be0f3f4e1
1 изменённых файлов: 2 добавлений и 0 удалений

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

@ -3191,6 +3191,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;