diff --git a/src/Composer/Installer/LibraryInstaller.php b/src/Composer/Installer/LibraryInstaller.php index 1f94f4071..a3f0b2b74 100644 --- a/src/Composer/Installer/LibraryInstaller.php +++ b/src/Composer/Installer/LibraryInstaller.php @@ -78,11 +78,9 @@ class LibraryInstaller implements InstallerInterface */ public function install(PackageInterface $package) { + $this->initializeDirs(); $downloadPath = $this->getInstallPath($package); - $this->filesystem->ensureDirectoryExists($this->vendorDir); - $this->filesystem->ensureDirectoryExists($this->binDir); - // remove the binaries if it appears the package files are missing if (!is_readable($downloadPath) && $this->repository->hasPackage($package)) { $this->removeBinaries($package); @@ -104,11 +102,9 @@ class LibraryInstaller implements InstallerInterface throw new \InvalidArgumentException('Package is not installed: '.$initial); } + $this->initializeDirs(); $downloadPath = $this->getInstallPath($initial); - $this->filesystem->ensureDirectoryExists($this->vendorDir); - $this->filesystem->ensureDirectoryExists($this->binDir); - $this->removeBinaries($initial); $this->downloadManager->update($initial, $target, $downloadPath); $this->installBinaries($target); @@ -191,6 +187,14 @@ class LibraryInstaller implements InstallerInterface } } + protected function initializeDirs() + { + $this->filesystem->ensureDirectoryExists($this->vendorDir); + $this->filesystem->ensureDirectoryExists($this->binDir); + $this->vendorDir = realpath($this->vendorDir); + $this->binDir = realpath($this->binDir); + } + private function generateWindowsProxyCode($bin, $link) { $binPath = $this->filesystem->findShortestPath($link, $bin);