From 7a154486cbfe815f9ae6bd3bc1126a262404bbad Mon Sep 17 00:00:00 2001 From: Gravitano Date: Mon, 18 May 2015 23:23:00 +0700 Subject: [PATCH] allow to create sub directory automatically. fix pingpong-labs/modules#157. --- src/Pingpong/Modules/Commands/GeneratorCommand.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Pingpong/Modules/Commands/GeneratorCommand.php b/src/Pingpong/Modules/Commands/GeneratorCommand.php index 543aee78..2eb2c534 100644 --- a/src/Pingpong/Modules/Commands/GeneratorCommand.php +++ b/src/Pingpong/Modules/Commands/GeneratorCommand.php @@ -26,7 +26,11 @@ abstract protected function getDestinationFilePath(); */ public function fire() { - $path = $this->getDestinationFilePath(); + $path = str_replace('\\', '/', $this->getDestinationFilePath()); + + if (! $this->laravel['files']->isDirectory($dir = dirname($path))) { + $this->laravel['files']->makeDirectory($path, 0777, true); + } $contents = $this->getTemplateContents();