Browse Source

Restore realpath behavior

Jordi Boggiano 13 years ago
parent
commit
f54b04aac8
1 changed files with 10 additions and 6 deletions
  1. 10 6
      src/Composer/Installer/LibraryInstaller.php

+ 10 - 6
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);