From e79bf087b5a6daaf50e07afafdda492c142d86df Mon Sep 17 00:00:00 2001 From: z2z Date: Thu, 2 Apr 2015 10:07:09 +0530 Subject: [PATCH] Update Psr4PathGenerator.php Try and create src folder if does not exist. --- lib/PathGenerator/Psr4PathGenerator.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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.");