Skip to content

Commit 57574f9

Browse files
committed
feature #20642 [FrameworkBundle] Add project directory default for installing assets (Noah Heck)
This PR was merged into the 3.3-dev branch. Discussion ---------- [FrameworkBundle] Add project directory default for installing assets | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #20337 | License | MIT | Doc PR | This allows the `assets:install` console command to have a fallback default of the project root directory. Current behavior is to install assets only in the `target` of the current working directory. Commits ------- 7a11f3ecf3 [FrameworkBundle] Add project directory default for installing assets
2 parents 5fcfc03 + c359772 commit 57574f9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Command/AssetsInstallCommand.php

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

8484
if (!is_dir($targetArg)) {
85-
throw new \InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target')));
85+
$appRoot = $this->getContainer()->getParameter('kernel.root_dir').'/..';
86+
87+
$targetArg = $appRoot.'/'.$targetArg;
88+
89+
if (!is_dir($targetArg)) {
90+
throw new \InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target')));
91+
}
8692
}
8793

8894
$this->filesystem = $this->getContainer()->get('filesystem');

0 commit comments

Comments
 (0)