You are here

protected function Minisite::prepareAssetDirectory in Mini site 8

Prepare asset directory.

Return value

string Prepared asset directory.

Throws

\Drupal\minisite\Exception\AssetException When unable to prepare asset.

1 call to Minisite::prepareAssetDirectory()
Minisite::processArchive in src/Minisite.php
Process archive by extracting files and filling-in assets information.

File

src/Minisite.php, line 386

Class

Minisite
Class Minisite.

Namespace

Drupal\minisite

Code

protected function prepareAssetDirectory() {

  /** @var \Drupal\Core\File\FileSystemInterface $fs */
  $fs = \Drupal::service('file_system');
  $dir = $this
    ->getAssetDirectory();
  if (!file_exists($dir)) {
    if (!$fs
      ->prepareDirectory($dir, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS)) {
      throw new AssetException(sprintf('Unable to prepare asset directory "%s"', $dir));
    }
  }
  return $dir;
}