From 9cdc9815ea495df6013c73d29c0524845a112a5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ste=CC=81phane=20Goetz?= Date: Sat, 18 Jul 2015 14:01:16 +0200 Subject: [PATCH] Add a few checks --- libs/Generator/Helper.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libs/Generator/Helper.php b/libs/Generator/Helper.php index 5161f26..cdda5e2 100644 --- a/libs/Generator/Helper.php +++ b/libs/Generator/Helper.php @@ -10,8 +10,11 @@ class Helper */ public static function copyAssets($path, $local_base) { - mkdir($path); - static::rmdir($path); + if (is_dir($path)) { + static::rmdir($path); + } else { + mkdir($path); + } mkdir($path . DS . 'resources'); static::copyRecursive($local_base . DS . 'resources', $path . DS . 'resources'); @@ -46,8 +49,11 @@ class Helper */ private static function copyRecursive($source, $destination) { + if (!is_dir($destination)) { + mkdir($destination); + } + $dir = opendir($source); - mkdir($destination); while (false !== ($file = readdir($dir))) { if ($file != '.' && $file != '..') { if (is_dir($source . '/' . $file)) {