From 66ab874570f920e97bade761dd1a8a6b2b03ca3a Mon Sep 17 00:00:00 2001 From: Spomky Date: Sat, 23 Sep 2017 21:40:44 +0200 Subject: [PATCH] Tries to create the storage folder --- src/Object/Storable.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Object/Storable.php b/src/Object/Storable.php index 1bc911cc..0fcbb2c0 100644 --- a/src/Object/Storable.php +++ b/src/Object/Storable.php @@ -36,6 +36,9 @@ trait Storable public function setFilename($filename) { Assertion::string($filename, 'Invalid filename.'); + if (!is_dir(dirname($filename))) { + mkdir(dirname($filename), 0777, true); + } Assertion::directory(dirname($filename), 'The selected directory does not exist.'); Assertion::writeable(dirname($filename), 'The selected directory is not writable.'); $this->filename = $filename;