Skip to content
This repository has been archived by the owner on Dec 30, 2020. It is now read-only.

Commit

Permalink
Tries to create the storage folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Spomky authored Sep 23, 2017
1 parent d72bf47 commit 66ab874
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Object/Storable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 66ab874

Please sign in to comment.