Skip to content

Commit ea70913

Browse files
authored
Merge pull request #150 from php-etl/feature/copy-filesystem
manage creation of directory recursively when the file to copy is under a non-existent directory
2 parents 85aaa1f + 91da338 commit ea70913

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Adapter/Filesystem/Satellite.php

+4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ public function build(
4848
fclose($stream);
4949
}
5050
} else {
51+
$dirname = \dirname($this->workdir.'/'.$file->getPath());
52+
if (!file_exists($dirname)) {
53+
mkdir($dirname, 0o755, true);
54+
}
5155
$stream = fopen($this->workdir.'/'.$file->getPath(), 'wb');
5256
stream_copy_to_stream($file->asResource(), $stream);
5357
fclose($stream);

0 commit comments

Comments
 (0)