Skip to content

Commit

Permalink
Fixed building with symlinked files with ConsoleScript
Browse files Browse the repository at this point in the history
this fixes #25 for ConsoleScript.
  • Loading branch information
dktapps committed Feb 14, 2018
1 parent 2d90902 commit 5cba480
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/DevTools/ConsoleScript.php
Expand Up @@ -155,7 +155,11 @@ function preg_quote_array(array $strings, string $delim = null) : array{
implode('|', preg_quote_array($includedPaths, '/')) //... and must be followed by one of these relative paths, if any were specified. If none, this will produce a null capturing group which will allow anything.
);

$count = count($phar->buildFromDirectory($basePath, $regex));
$directory = new \RecursiveDirectoryIterator($basePath, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS | \FilesystemIterator::CURRENT_AS_PATHNAME); //can't use fileinfo because of symlinks
$iterator = new \RecursiveIteratorIterator($directory);
$regexIterator = new \RegexIterator($iterator, $regex);

$count = count($phar->buildFromIterator($regexIterator, $basePath));
echo "Added $count files" . PHP_EOL;

$phar->stopBuffering();
Expand Down

0 comments on commit 5cba480

Please sign in to comment.