From b2d8c333257bc5fdf2385e8c454c546671ddabdf Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Tue, 19 Dec 2023 17:11:49 +0100 Subject: [PATCH] Do not include config files twice --- packages/guides-cli/bin/guides | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/guides-cli/bin/guides b/packages/guides-cli/bin/guides index 4f301db0a..21d41441b 100755 --- a/packages/guides-cli/bin/guides +++ b/packages/guides-cli/bin/guides @@ -40,18 +40,19 @@ if ($input->hasParameterOption('-vvv', true)) { $containerFactory = new ContainerFactory([new ApplicationExtension()]); -if (is_file($vendorDir . '/../guides.xml')) { +$projectConfig = realpath($vendorDir . '/../guides.xml'); +if (is_file($projectConfig)) { if ($verbosity === 3) { - echo 'Loading guides.xml from ' . $vendorDir . '/../guides.xml' . PHP_EOL; + echo 'Loading guides.xml from ' . $projectConfig . PHP_EOL; } // vendor folder was placed directly into the project directory - $containerFactory->addConfigFile($vendorDir . '/../guides.xml'); + $containerFactory->addConfigFile($projectConfig); } $workingDir = $input->getParameterOption('--working-dir', getcwd(), true); $localConfig = $input->getParameterOption('--config', $workingDir, true).'/guides.xml'; -if (is_file($localConfig)) { +if (is_file($localConfig) && realpath($localConfig) !== $projectConfig) { if ($verbosity === 3) { echo 'Loading guides.xml from ' . $localConfig . PHP_EOL; }