You are here

protected function FileCopy::getDirectory in Migrate Plus 8.2

Returns the directory component of a URI or path.

For URIs like public://foo.txt, the full physical path of public:// will be returned, since a scheme by itself will trip up certain file API functions (such as file_prepare_directory()).

Parameters

string $uri: The URI or path.

Return value

string|false The directory component of the path or URI, or FALSE if it could not be determined.

1 call to FileCopy::getDirectory()
FileCopy::transform in src/Plugin/migrate/process/FileCopy.php
Performs the associated process.

File

src/Plugin/migrate/process/FileCopy.php, line 169

Class

FileCopy
Copy a file from one place into another.

Namespace

Drupal\migrate_plus\Plugin\migrate\process

Code

protected function getDirectory($uri) {
  $dir = $this->fileSystem
    ->dirname($uri);
  if (substr($dir, -3) == '://') {
    return $this->fileSystem
      ->realpath($dir);
  }
  return $dir;
}