From 44761cb4df32f987b02adc328a12939a8d8fd093 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 17 Jan 2024 11:38:44 +0100 Subject: [PATCH] manage creation of directory recursively when the file to copy is under a non-existent directory --- src/Adapter/Filesystem/Satellite.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Adapter/Filesystem/Satellite.php b/src/Adapter/Filesystem/Satellite.php index d8edbc01..9e3bd2ac 100644 --- a/src/Adapter/Filesystem/Satellite.php +++ b/src/Adapter/Filesystem/Satellite.php @@ -49,6 +49,14 @@ public function build( } } else { $stream = fopen($this->workdir.'/'.$file->getPath(), 'wb'); + if (!$stream) { + $dirname = dirname($this->workdir.'/'.$file->getPath()); + if (!is_dir($dirname)) + { + mkdir($dirname, 0755, true); + } + $stream = fopen($this->workdir.'/'.$file->getPath(), 'wb'); + } stream_copy_to_stream($file->asResource(), $stream); fclose($stream); }