Skip to content

Commit

Permalink
Compare file path with same separators
Browse files Browse the repository at this point in the history
Transform both file paths to have similar path delimiters before comparing them.
Proposed solution to issue #54
  • Loading branch information
szekely-szabolcs authored and exussum12 committed Apr 17, 2019
1 parent 7dc1877 commit 9d31de2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/FileMatchers/EndsWith.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ protected function fileEndsWith($haystack, $needle)
return $this->fileEndsWith($needle, $haystack);
}

$haystack = str_replace('\\', '/', $haystack);
$needle = str_replace('\\', '/', $needle);

return (substr($haystack, -$length) === $needle);
}
}

0 comments on commit 9d31de2

Please sign in to comment.