Skip to content

Commit ec42c42

Browse files
committed
Create non-existent directories when generating classes
1 parent 6513cdb commit ec42c42

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Console/BuildCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
4646
$absoluteFilePath = $targetDirectory . DIRECTORY_SEPARATOR . $relativeFilePath;
4747
$absoluteFilePathWithoutResolution = ($specifiedTargetDirectory ?: $sourceDirectory) . \DIRECTORY_SEPARATOR . $relativeFilePath;
4848
\fwrite(\STDOUT, "$absoluteFilePathWithoutResolution\n");
49+
$directoryPath = \dirname($absoluteFilePath);
50+
if (!\file_exists($directoryPath)) {
51+
\mkdir($directoryPath, 0744, true);
52+
}
4953
\file_put_contents($absoluteFilePath, "<?php\n$autoClass\n");
5054
}
5155
}

0 commit comments

Comments
 (0)