Skip to content

Commit d51400c

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 <[email protected]>
1 parent 790823e commit d51400c

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
@@ -3244,6 +3244,8 @@ static int cmp_icase(char a, char b)
32443244
{
32453245
if (a == b)
32463246
return 0;
3247+
if (is_dir_sep(a))
3248+
return is_dir_sep(b) ? 0 : -1;
32473249
if (ignore_case)
32483250
return toupper(a) - toupper(b);
32493251
return a - b;

0 commit comments

Comments
 (0)