From 661df121d9687fcebe76897e8efc4bc279613502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20M=C3=A1rton?= Date: Fri, 8 Mar 2013 16:06:53 +0100 Subject: [PATCH] Proposed fix for #1675 --- src/Composer/Installer/LibraryInstaller.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Composer/Installer/LibraryInstaller.php b/src/Composer/Installer/LibraryInstaller.php index 5bbba4815..21e3d20da 100644 --- a/src/Composer/Installer/LibraryInstaller.php +++ b/src/Composer/Installer/LibraryInstaller.php @@ -121,12 +121,11 @@ class LibraryInstaller implements InstallerInterface throw new \InvalidArgumentException('Package is not installed: '.$package); } - $downloadPath = $this->getInstallPath($package); - $this->removeCode($package); $this->removeBinaries($package); $repo->removePackage($package); + $downloadPath = $this->getPackageBasePath($package); if (strpos($package->getName(), '/')) { $packageVendorDir = dirname($downloadPath); if (is_dir($packageVendorDir) && !glob($packageVendorDir.'/*')) { @@ -140,10 +139,14 @@ class LibraryInstaller implements InstallerInterface */ public function getInstallPath(PackageInterface $package) { - $this->initializeVendorDir(); $targetDir = $package->getTargetDir(); + return $this->getPackageBasePath($package) . ($targetDir ? '/'.$targetDir : ''); + } - return ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName() . ($targetDir ? '/'.$targetDir : ''); + protected function getPackageBasePath(PackageInterface $package) + { + $this->initializeVendorDir(); + return ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName(); } protected function installCode(PackageInterface $package) @@ -160,7 +163,7 @@ class LibraryInstaller implements InstallerInterface protected function removeCode(PackageInterface $package) { - $downloadPath = $this->getInstallPath($package); + $downloadPath = $this->getPackageBasePath($package); $this->downloadManager->remove($package, $downloadPath); }