Skip to content

Commit 94fe5f4

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 2145fbc commit 94fe5f4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

dir.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3122,6 +3122,8 @@ static int cmp_icase(char a, char b)
31223122
{
31233123
if (a == b)
31243124
return 0;
3125+
if (is_dir_sep(a))
3126+
return is_dir_sep(b) ? 0 : -1;
31253127
if (ignore_case)
31263128
return toupper(a) - toupper(b);
31273129
return a - b;

0 commit comments

Comments
 (0)