You are here

protected static function Command::getDestination in Config Importer and Tools 8

Same name and namespace in other branches
  1. 8.2 src/Drush/Command.php \Drupal\config_import\Drush\Command::getDestination()
  2. 8.0 src/Drush/Command.php \Drupal\config_import\Drush\Command::getDestination()

Returns a path to configuration file.

Parameters

string $destination: Path to directory or the name of configurations directory.

string $name: The name of file.

Return value

string Path to the configuration file.

1 call to Command::getDestination()
Command::processOptions in src/Drush/Command.php
Process a list of options for the current command.

File

src/Drush/Command.php, line 168

Class

Command
Class Command.

Namespace

Drupal\config_import\Drush

Code

protected static function getDestination($destination, $name) {
  $destination = rtrim($destination, '/');
  if (!is_dir($destination)) {

    // Exception will be thrown if directory cannot be determined by type.
    $destination = config_get_config_directory($destination);
  }
  if (!is_dir($destination)) {
    throw new \RuntimeException(dt('Destination directory "@destination" does not exists!', [
      '@destination' => $destination,
    ]));
  }
  return "{$destination}/{$name}.yml";
}