diff --git a/src/Composer/Downloader/PathDownloader.php b/src/Composer/Downloader/PathDownloader.php index 5c4cbcf61..d7f0c06ee 100644 --- a/src/Composer/Downloader/PathDownloader.php +++ b/src/Composer/Downloader/PathDownloader.php @@ -75,7 +75,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter } // Get the transport options with default values - $transportOptions = $package->getTransportOptions() + array('symlink' => null); + $transportOptions = $package->getTransportOptions() + array('symlink' => null, 'relative' => true); // When symlink transport option is null, both symlink and mirror are allowed $currentStrategy = self::STRATEGY_SYMLINK; @@ -126,7 +126,11 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl); $path = rtrim($path, "/"); $this->io->writeError(sprintf('Symlinking from %s', $url), false); - $fileSystem->symlink($shortestPath, $path); + if ($transportOptions['relative']) { + $fileSystem->symlink($shortestPath, $path); + } else { + $fileSystem->symlink($absolutePath, $path); + } } } catch (IOException $e) { if (in_array(self::STRATEGY_MIRROR, $allowedStrategies)) { diff --git a/src/Composer/Repository/PathRepository.php b/src/Composer/Repository/PathRepository.php index 5b6a770b2..4e860658f 100644 --- a/src/Composer/Repository/PathRepository.php +++ b/src/Composer/Repository/PathRepository.php @@ -20,6 +20,7 @@ use Composer\Package\Version\VersionGuesser; use Composer\Package\Version\VersionParser; use Composer\Util\Platform; use Composer\Util\ProcessExecutor; +use Composer\Util\Filesystem; /** * This repository allows installing local packages that are not necessarily under their own VCS. @@ -107,6 +108,10 @@ class PathRepository extends ArrayRepository implements ConfigurableRepositoryIn $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser()); $this->repoConfig = $repoConfig; $this->options = isset($repoConfig['options']) ? $repoConfig['options'] : array(); + if (!isset($this->options['relative'])) { + $filesystem = new Filesystem(); + $this->options['relative'] = !$filesystem->isAbsolutePath($this->url); + } parent::__construct(); }