Skip to content

Commit

Permalink
be smarter when guessing the document root
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Nov 20, 2014
1 parent 84f4c4b commit e28f5b8
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -44,7 +44,7 @@ protected function configure()
$this
->setDefinition(array(
new InputArgument('address', InputArgument::OPTIONAL, 'Address:port', 'localhost:8000'),
new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root', 'web/'),
new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root', null),
new InputOption('router', 'r', InputOption::VALUE_REQUIRED, 'Path to custom router script'),
))
->setName('server:run')
Expand Down Expand Up @@ -83,6 +83,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$documentRoot = $input->getOption('docroot');

if (null === $documentRoot) {
$documentRoot = $this->getContainer()->getParameter('kernel.root_dir').'/../web';
}

if (!is_dir($documentRoot)) {
$output->writeln(sprintf('<error>The given document root directory "%s" does not exist</error>', $documentRoot));

Expand Down

0 comments on commit e28f5b8

Please sign in to comment.