diff --git a/src/Composer/Installer/LibraryInstaller.php b/src/Composer/Installer/LibraryInstaller.php index 898c4a6b9..727e84c85 100644 --- a/src/Composer/Installer/LibraryInstaller.php +++ b/src/Composer/Installer/LibraryInstaller.php @@ -123,6 +123,11 @@ class LibraryInstaller implements InstallerInterface */ public function getInstallPath(PackageInterface $package) { + $installDir = $package->getInstallDir(); + if (isset($installDir)) + { + return $installDir; + } $targetDir = $package->getTargetDir(); return ($this->directory ? $this->directory.'/' : '') . $package->getName() . ($targetDir ? '/'.$targetDir : ''); } diff --git a/src/Composer/Package/BasePackage.php b/src/Composer/Package/BasePackage.php index 786c58ae5..c22b3fdab 100644 --- a/src/Composer/Package/BasePackage.php +++ b/src/Composer/Package/BasePackage.php @@ -27,6 +27,7 @@ abstract class BasePackage implements PackageInterface protected $prettyName; protected $repository; protected $id; + protected $installDir; /** * All descendants' constructors should call this parent constructor @@ -92,6 +93,16 @@ abstract class BasePackage implements PackageInterface return $this->id; } + public function setInstallDir($dir) + { + $this->installDir = $dir; + } + + public function getInstallDir() + { + return $this->installDir; + } + /** * Checks if the package matches the given constraint directly or through * provided or replaced packages diff --git a/src/Composer/Package/Loader/ArrayLoader.php b/src/Composer/Package/Loader/ArrayLoader.php index 4977763b8..51e0729e3 100644 --- a/src/Composer/Package/Loader/ArrayLoader.php +++ b/src/Composer/Package/Loader/ArrayLoader.php @@ -53,6 +53,10 @@ class ArrayLoader $package->setTargetDir($config['target-dir']); } + if (isset($config['install-dir'])) { + $package->setInstallDir($config['install-dir']); + } + if (isset($config['repositories'])) { $repositories = array(); foreach ($config['repositories'] as $repoName => $repo) {