Skip to content

Commit bfc1669

Browse files
committed
minor #22843 use getProjectDir() when possible (xabbuh)
This PR was merged into the 3.3 branch. Discussion ---------- use getProjectDir() when possible | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | continues #22315 | License | MIT | Doc PR | Commits ------- a8e298a66c use getProjectDir() when possible
2 parents de74ec3 + bbb2e6d commit bfc1669

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

Command/AboutCommand.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
4646

4747
/** @var $kernel KernelInterface */
4848
$kernel = $this->getContainer()->get('kernel');
49-
$baseDir = realpath($kernel->getRootDir().DIRECTORY_SEPARATOR.'..');
5049

5150
$io->table(array(), array(
5251
array('<info>Symfony</>'),
@@ -62,9 +61,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
6261
array('Environment', $kernel->getEnvironment()),
6362
array('Debug', $kernel->isDebug() ? 'true' : 'false'),
6463
array('Charset', $kernel->getCharset()),
65-
array('Root directory', self::formatPath($kernel->getRootDir(), $baseDir)),
66-
array('Cache directory', self::formatPath($kernel->getCacheDir(), $baseDir).' (<comment>'.self::formatFileSize($kernel->getCacheDir()).'</>)'),
67-
array('Log directory', self::formatPath($kernel->getLogDir(), $baseDir).' (<comment>'.self::formatFileSize($kernel->getLogDir()).'</>)'),
64+
array('Root directory', self::formatPath($kernel->getRootDir(), $kernel->getProjectDir())),
65+
array('Cache directory', self::formatPath($kernel->getCacheDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getCacheDir()).'</>)'),
66+
array('Log directory', self::formatPath($kernel->getLogDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getLogDir()).'</>)'),
6867
new TableSeparator(),
6968
array('<info>PHP</>'),
7069
new TableSeparator(),

Command/AssetsInstallCommand.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8282
$targetArg = rtrim($input->getArgument('target'), '/');
8383

8484
if (!is_dir($targetArg)) {
85-
$appRoot = $this->getContainer()->getParameter('kernel.root_dir').'/..';
86-
87-
$targetArg = $appRoot.'/'.$targetArg;
85+
$targetArg = $this->getContainer()->getParameter('kernel.project_dir').'/'.$targetArg;
8886

8987
if (!is_dir($targetArg)) {
9088
throw new \InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target')));

0 commit comments

Comments
 (0)