You are here

protected function ManageOptions::ensureLocations in Drupal 10

Same name and namespace in other branches
  1. 8 composer/Plugin/Scaffold/ManageOptions.php \Drupal\Composer\Plugin\Scaffold\ManageOptions::ensureLocations()
  2. 9 composer/Plugin/Scaffold/ManageOptions.php \Drupal\Composer\Plugin\Scaffold\ManageOptions::ensureLocations()

Ensures that all of the locations defined in the scaffold files exist.

Create them on the filesystem if they do not.

1 call to ManageOptions::ensureLocations()
ManageOptions::getLocationReplacements in composer/Plugin/Scaffold/ManageOptions.php
Creates an interpolator for the 'locations' element.

File

composer/Plugin/Scaffold/ManageOptions.php, line 81

Class

ManageOptions
Per-project options from the 'extras' section of the composer.json file.

Namespace

Drupal\Composer\Plugin\Scaffold

Code

protected function ensureLocations() {
  $fs = new Filesystem();
  $locations = $this
    ->getOptions()
    ->locations() + [
    'web_root' => './',
  ];
  $locations = array_map(function ($location) use ($fs) {
    $fs
      ->ensureDirectoryExists($location);
    $location = realpath($location);
    return $location;
  }, $locations);
  return $locations;
}