Skip to content

Commit

Permalink
Merge pull request #150 from php-etl/feature/copy-filesystem
Browse files Browse the repository at this point in the history
manage creation of directory recursively when the file to copy is under a non-existent directory
  • Loading branch information
gplanchat authored Feb 1, 2024
2 parents 85aaa1f + 91da338 commit ea70913
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Adapter/Filesystem/Satellite.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ public function build(
fclose($stream);
}
} else {
$dirname = \dirname($this->workdir.'/'.$file->getPath());
if (!file_exists($dirname)) {
mkdir($dirname, 0o755, true);
}
$stream = fopen($this->workdir.'/'.$file->getPath(), 'wb');
stream_copy_to_stream($file->asResource(), $stream);
fclose($stream);
Expand Down

0 comments on commit ea70913

Please sign in to comment.