Skip to content

Commit

Permalink
Create non-existent directories when generating classes
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdifabio committed Nov 8, 2018
1 parent 6513cdb commit ec42c42
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Console/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
$absoluteFilePath = $targetDirectory . DIRECTORY_SEPARATOR . $relativeFilePath;
$absoluteFilePathWithoutResolution = ($specifiedTargetDirectory ?: $sourceDirectory) . \DIRECTORY_SEPARATOR . $relativeFilePath;
\fwrite(\STDOUT, "$absoluteFilePathWithoutResolution\n");
$directoryPath = \dirname($absoluteFilePath);
if (!\file_exists($directoryPath)) {
\mkdir($directoryPath, 0744, true);
}
\file_put_contents($absoluteFilePath, "<?php\n$autoClass\n");
}
}
Expand Down

0 comments on commit ec42c42

Please sign in to comment.