protected function FileCopy::getDirectory in Drupal 8
Same name and namespace in other branches
- 9 core/modules/migrate/src/Plugin/migrate/process/FileCopy.php \Drupal\migrate\Plugin\migrate\process\FileCopy::getDirectory()
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 \Drupal\Core\File\FileSystemInterface::prepareDirectory()).
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 core/
modules/ migrate/ src/ Plugin/ migrate/ process/ FileCopy.php - Performs the associated process.
File
- core/
modules/ migrate/ src/ Plugin/ migrate/ process/ FileCopy.php, line 211
Class
- FileCopy
- Copies or moves a local file from one place into another.
Namespace
Drupal\migrate\Plugin\migrate\processCode
protected function getDirectory($uri) {
$dir = $this->fileSystem
->dirname($uri);
if (substr($dir, -3) == '://') {
return $this->fileSystem
->realpath($dir);
}
return $dir;
}