Skip to content

Commit d5529af

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 49b382a commit d5529af

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
@@ -3231,6 +3231,8 @@ static int cmp_icase(char a, char b)
32313231
{
32323232
if (a == b)
32333233
return 0;
3234+
if (is_dir_sep(a))
3235+
return is_dir_sep(b) ? 0 : -1;
32343236
if (ignore_case)
32353237
return toupper(a) - toupper(b);
32363238
return a - b;

0 commit comments

Comments
 (0)