Skip to content

Commit 3028c8c

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 8668424 commit 3028c8c

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
@@ -3226,6 +3226,8 @@ static int cmp_icase(char a, char b)
32263226
{
32273227
if (a == b)
32283228
return 0;
3229+
if (is_dir_sep(a))
3230+
return is_dir_sep(b) ? 0 : -1;
32293231
if (ignore_case)
32303232
return toupper(a) - toupper(b);
32313233
return a - b;

0 commit comments

Comments
 (0)