Skip to content

Commit

Permalink
Fix FileManager for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
villfa committed Oct 12, 2020
1 parent b997304 commit 3a4957f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Managers/FileManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private function fileShouldBeIgnored(SplFileInfo $file): bool
{
foreach ($this->filesToIgnore as $fileToIgnore) {
$regex = $this->patternToRegex($fileToIgnore);
if (preg_match("#{$regex}#", $file->getPathName())) {
if (preg_match("#{$regex}#", $file->getRealPath())) {
return true;
}
}
Expand All @@ -101,7 +101,11 @@ private function fileShouldBeIgnored(SplFileInfo $file): bool
*/
private function patternToRegex(string $filePattern): string
{
$regex = preg_replace("#/(.*)\*([\w.]*)$#", "/$1.+$2$", $filePattern);
$regex = preg_replace("#(.*)\*([\w.]*)$#", "$1.+$2$", $filePattern);
if (DIRECTORY_SEPARATOR === '\\') {
$regex = str_replace('/', '\\\\', $regex);
}

return $regex;
}
}

0 comments on commit 3a4957f

Please sign in to comment.