Webiny\Component\Storage\Driver\Local\LocalHelper::ensureDirectoryExists PHP Method

ensureDirectoryExists() public method

Make sure the target directory exists
public ensureDirectoryExists ( string $directory, boolean $create = false )
$directory string Path to check
$create boolean (Optional) Create path if doesn't exist
    public function ensureDirectoryExists($directory, $create = false)
    {
        if (!is_dir($directory)) {
            if (!$create) {
                throw new StorageException(StorageException::DIRECTORY_DOES_NOT_EXIST, [$directory]);
            }
            $this->createDirectory($directory);
        }
    }