1
0
Fork 0

Uses `realpath` to fix relative path issues

pull/4419/head
Samuel ROZE 2015-09-14 15:20:06 +01:00
parent a3f5f60359
commit d0a9550dea
1 changed files with 5 additions and 4 deletions

View File

@ -39,18 +39,19 @@ class PathDownloader extends FileDownloader
));
$url = $package->getDistUrl();
if (!file_exists($url) || !is_dir($url)) {
$realUrl = realpath($url);
if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
throw new \RuntimeException(sprintf(
'Path "%s" is not found',
$path
$url
));
}
try {
$fileSystem->symlink($url, $path);
$fileSystem->symlink($realUrl, $path);
$this->io->writeError(sprintf(' Symlinked from %s', $url));
} catch (IOException $e) {
$fileSystem->mirror($url, $path);
$fileSystem->mirror($realUrl, $path);
$this->io->writeError(sprintf(' Mirrored from %s', $url));
}