Explorar el Código

act on target-dir changes during update

Karoly Negyesi hace 11 años
padre
commit
b333d7a485
Se han modificado 1 ficheros con 6 adiciones y 2 borrados
  1. 6 2
      src/Composer/Installer/LibraryInstaller.php

+ 6 - 2
src/Composer/Installer/LibraryInstaller.php

@@ -157,8 +157,12 @@ class LibraryInstaller implements InstallerInterface
 
     protected function updateCode(PackageInterface $initial, PackageInterface $target)
     {
-        $downloadPath = $this->getInstallPath($initial);
-        $this->downloadManager->update($initial, $target, $downloadPath);
+        $initialDownloadPath = $this->getInstallPath($initial);
+        $targetDownloadPath = $this->getInstallPath($target);
+        if ($targetDownloadPath != $initialDownloadPath) {
+            $this->filesystem->copyThenRemove($initialDownloadPath, $targetDownloadPath);
+        }
+        $this->downloadManager->update($initial, $target, $targetDownloadPath);
     }
 
     protected function removeCode(PackageInterface $package)