Skip to content

Commit 1d29eb8

Browse files
committed
Handle relative paths correctly
1 parent c004f49 commit 1d29eb8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Command/RebuildCommand.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6464
{
6565
$this->logger = new ConsoleLogger($output);
6666

67-
$config = Yaml::parse(file_get_contents($input->getOption('config')));
68-
$outdir = $input->getOption('output-directory');
67+
$configFile = realpath($input->getOption('config'));
68+
if (!is_readable($configFile)) {
69+
throw new \InvalidArgumentException('Config file not found: ' . $input->getOption('config'));
70+
}
71+
$outdir = realpath($input->getOption('output-directory'));
72+
73+
chdir(dirname($configFile));
74+
75+
$config = Yaml::parse(file_get_contents($configFile));
6976
if (!is_dir($outdir)) {
7077
mkdir($outdir, 0775, true);
7178
}

0 commit comments

Comments
 (0)