diff --git a/module/Client/src/Client/Service/ZpkInvokable.php b/module/Client/src/Client/Service/ZpkInvokable.php index 3fb6dfd..6532576 100644 --- a/module/Client/src/Client/Service/ZpkInvokable.php +++ b/module/Client/src/Client/Service/ZpkInvokable.php @@ -333,7 +333,9 @@ public function pack($sourceFolder, $destinationFolder=".", $fileName=null, arra if (in_array($baseDir . '/' . $path, $excludes)) continue; $zpk->addFile($fullPath, $this->fixZipPath($baseDir . '/' . $path)); } elseif (is_dir($fullPath)) { - $this->addDir($zpk, $fullPath, $baseDir, $excludes); + // Scripts directories should be added differently + $isScriptDirectory = ($key=='scriptsdir.includes'); + $this->addDir($zpk, $fullPath, $baseDir, $excludes, $isScriptDirectory); } else { throw new \Zend\ServiceManager\Exception\RuntimeException("Path '$fullPath' is not existing. Verify your deployment.properties!"); } @@ -364,9 +366,11 @@ protected function fixZipPath($path) * @param string $directory * @param string $baseDir */ - protected function addDir($zpk, $directory, $baseDir = null, $excludes = array()) - { - if ($baseDir) { + protected function addDir($zpk, $directory, $baseDir = null, $excludes = array(), $isSciptDirectory = false) + { + if ($isSciptDirectory AND $baseDir) { + $currentZipFolder = $baseDir; + } elseif ($baseDir) { $currentZipFolder = $baseDir.'/'.basename($directory); } else { $currentZipFolder = basename($directory); @@ -387,7 +391,7 @@ protected function addDir($zpk, $directory, $baseDir = null, $excludes = array() $path = $directory."/".$path; if (is_dir($path)) { - $this->addDir($zpk, $path, $currentZipFolder, $excludes); + $this->addDir($zpk, $path, $currentZipFolder, $excludes, $isSciptDirectory); } elseif (file_exists($path)) { $success = $zpk->addFile($path, $this->fixZipPath($currentZipFolder.'/'.basename($path))); if (!$success) { @@ -524,4 +528,4 @@ protected static function fixMetaKeyOrder(array $data) return $meta; } -} +} \ No newline at end of file