Skip to content
Snippets Groups Projects
Commit 84e04074 authored by Adam G-H's avatar Adam G-H
Browse files

Simplifly compiling unknown paths

parent 73479c59
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !992. Comments created here will be created in the context of that merge request.
......@@ -102,20 +102,19 @@ final class UnknownPathExcluder implements EventSubscriberInterface {
// glob() flags aren't supported on all systems. We also can't use
// \Drupal\Core\File\FileSystemInterface::scanDirectory(), because it
// unconditionally ignores hidden files and directories.
$paths_in_project_root = [];
$unknown_paths = [];
$handle = opendir($project_root);
if (empty($handle)) {
throw new \RuntimeException("Could not scan for files in the project root.");
}
while ($entry = readdir($handle)) {
if ($entry === '.' || $entry === '..') {
if ($entry === '.' || $entry === '..' || in_array($entry, $known_paths, TRUE)) {
continue;
}
$paths_in_project_root[] = $entry;
$unknown_paths[] = $entry;
}
closedir($handle);
$unknown_paths = array_diff($paths_in_project_root, $known_paths);
$event->addPathsRelativeToProjectRoot($unknown_paths);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment