From 2d3ed2d9de3a7ead91c664e96bbc7c8ac0b790f9 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 2 Sep 2017 00:49:33 -0700 Subject: [PATCH] [console] Create default directories. Fix #220. --- src/Command/InitCommand.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Command/InitCommand.php b/src/Command/InitCommand.php index 0171ee7..095ea24 100644 --- a/src/Command/InitCommand.php +++ b/src/Command/InitCommand.php @@ -10,6 +10,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Process\ProcessBuilder; use Symfony\Component\Finder\Finder; use Drupal\Console\Core\Utils\ConfigurationManager; @@ -59,6 +60,11 @@ class InitCommand extends Command 'generate_chain' => false ]; + private $directories = [ + 'chain', + 'sites', + ]; + /** * InitCommand constructor. * @@ -229,6 +235,13 @@ protected function execute(InputInterface $input, OutputInterface $output) $destinationFile ); + $fs = new Filesystem(); + foreach ($this->directories as $directory) { + if (!$fs->exists($destination.$directory)) { + $fs->mkdir($destination.$directory); + } + } + if ($this->copyFile($sourceFile, $destinationFile, $override)) { $copiedFiles[] = $destinationFile; }