Skip to content

Commit

Permalink
Auto-create cache dir as it is likely not to exist
Browse files Browse the repository at this point in the history
  • Loading branch information
woutersamaey committed Mar 14, 2022
1 parent 5103244 commit c9f02a4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/AbstractFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public function __construct(?string $cacheDir = null)
{
if (!$cacheDir) {
$cacheDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'cache';
if(!is_dir($cacheDir)) {
mkdir($cacheDir, 0777, true);
}
}

$this->cacheDir = rtrim($cacheDir, '/');
Expand Down

0 comments on commit c9f02a4

Please sign in to comment.