From 4e9885e9bc411db5ab7af0c6ddbd2b9e38914d44 Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Wed, 23 Mar 2016 12:19:41 +0100 Subject: [PATCH] Make sure to use an absolute path for symlinking in PathDownloader. Resolves #4451 --- src/Composer/Downloader/PathDownloader.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Composer/Downloader/PathDownloader.php b/src/Composer/Downloader/PathDownloader.php index 29465df39..e44fc155e 100644 --- a/src/Composer/Downloader/PathDownloader.php +++ b/src/Composer/Downloader/PathDownloader.php @@ -79,7 +79,11 @@ class PathDownloader extends FileDownloader $this->filesystem->junction($realUrl, $path); $this->io->writeError(sprintf(' Junctioned from %s', $url)); } else { - $shortestPath = $this->filesystem->findShortestPath($path, $realUrl); + $absolutePath = $path; + if ( ! $this->filesystem->isAbsolutePath($absolutePath)) { + $absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path; + } + $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl); $fileSystem->symlink($shortestPath, $path); $this->io->writeError(sprintf(' Symlinked from %s', $url)); }