Skip to content

Commit e28f5b8

Browse files
committed
be smarter when guessing the document root
1 parent 84f4c4b commit e28f5b8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function configure()
4444
$this
4545
->setDefinition(array(
4646
new InputArgument('address', InputArgument::OPTIONAL, 'Address:port', 'localhost:8000'),
47-
new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root', 'web/'),
47+
new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root', null),
4848
new InputOption('router', 'r', InputOption::VALUE_REQUIRED, 'Path to custom router script'),
4949
))
5050
->setName('server:run')
@@ -83,6 +83,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
8383
{
8484
$documentRoot = $input->getOption('docroot');
8585

86+
if (null === $documentRoot) {
87+
$documentRoot = $this->getContainer()->getParameter('kernel.root_dir').'/../web';
88+
}
89+
8690
if (!is_dir($documentRoot)) {
8791
$output->writeln(sprintf('<error>The given document root directory "%s" does not exist</error>', $documentRoot));
8892

0 commit comments

Comments
 (0)