From f7ac02179c09d7f067121a91ca3d10e810d6bf66 Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Thu, 22 Sep 2022 09:59:44 +0100 Subject: [PATCH] feature: allow nested directories fixes #14 --- src/FileAccess.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/FileAccess.php b/src/FileAccess.php index 1a1bb31..1ef0924 100644 --- a/src/FileAccess.php +++ b/src/FileAccess.php @@ -18,10 +18,10 @@ public function getData(string $name):mixed { } public function setData(string $name, mixed $value):void { - if(!is_dir($this->dirPath)) { - mkdir($this->dirPath, 0775, true); - } $filePath = "$this->dirPath/$name"; + if(!is_dir(dirname($filePath))) { + mkdir(dirname($filePath), 0775, true); + } file_put_contents($filePath, serialize($value)); }