diff --git a/lib/PathGenerator/Psr4PathGenerator.php b/lib/PathGenerator/Psr4PathGenerator.php index b4e607f..242a4ba 100644 --- a/lib/PathGenerator/Psr4PathGenerator.php +++ b/lib/PathGenerator/Psr4PathGenerator.php @@ -15,7 +15,9 @@ public function __construct(array $namespaces) throw new PathGeneratorException("A non-empty PSR-4 prefix must end with a namespace separator, you entered '$namespace'."); } if (! is_dir($dir)) { - throw new PathGeneratorException("The folder '$dir' does not exist."); + if (!mkdir($dir, 0777, true)) { + throw new PathGeneratorException("The folder '$dir' does not exist and failed to create."); + } } if (! is_writable($dir)) { throw new PathGeneratorException("The folder '$dir' is not writable.");