Skip to content

Commit a1a0063

Browse files
committed
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>
1 parent aeb961f commit a1a0063

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

dir.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3142,6 +3142,8 @@ static int cmp_icase(char a, char b)
31423142
{
31433143
if (a == b)
31443144
return 0;
3145+
if (is_dir_sep(a))
3146+
return is_dir_sep(b) ? 0 : -1;
31453147
if (ignore_case)
31463148
return toupper(a) - toupper(b);
31473149
return a - b;

0 commit comments

Comments
 (0)