Skip to content

Commit

Permalink
manage creation of directory recursively when the file to copy is und…
Browse files Browse the repository at this point in the history
…er a non-existent directory
  • Loading branch information
JoMessina committed Jan 17, 2024
1 parent 2d5a4dc commit 44761cb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Adapter/Filesystem/Satellite.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 44761cb

Please sign in to comment.