Skip to content
Snippets Groups Projects
Commit d898a736 authored by jurgenhaas's avatar jurgenhaas
Browse files

#7 Safer use of Finder()

parent a32c83a9
No related branches found
No related tags found
No related merge requests found
......@@ -293,14 +293,16 @@ class Handler
/**
* @param FileSystem $fs
* @param Finder $finder
* @param string $source
* @param string $destination
* @return array
*/
protected function copyFiles($fs, $finder, $source, $destination) {
protected function copyFiles($fs, $source, $destination) {
$files = [];
// Make sure all directories do exist
$finder = new Finder();
$finder->ignoreDotFiles(FALSE);
$finder->directories()->in($source);
foreach ($finder as $file) {
$path = $destination . DIRECTORY_SEPARATOR . $this->twig($file->getRelativePathname());
......@@ -309,6 +311,8 @@ class Handler
}
}
$finder = new Finder();
$finder->ignoreDotFiles(FALSE);
$finder->files()->in($source);
foreach ($finder as $file) {
......@@ -353,11 +357,9 @@ class Handler
$pluginRoot = $this->getInstallationManager()
->getInstallPath($this->getPackage('lakedrops/theme-d8-sass'));
$finder = new Finder();
$finder->ignoreDotFiles(FALSE);
// Copy all files
$this->copyFiles($fs, $finder, $pluginRoot . '/templates', $destination);
$this->copyFiles($fs, $pluginRoot . '/templates', $destination);
// Handle optional base theme
$baseTheme = $this->getOption('base_theme');
......@@ -365,7 +367,7 @@ class Handler
$baseThemePackage = $this->getPackage($baseTheme['package']);
if ($baseThemePackage && isset($baseTheme['starterkit'])) {
$starterkitRoot = $this->getInstallationManager()->getInstallPath($baseThemePackage) . DIRECTORY_SEPARATOR . $baseTheme['starterkit'];
$this->options['base_theme_files'] = $this->copyFiles($fs, $finder, $starterkitRoot , $destination);
$this->options['base_theme_files'] = $this->copyFiles($fs, $starterkitRoot , $destination);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment