瀏覽代碼

act on target-dir changes during update

Karoly Negyesi 11 年之前
父節點
當前提交
b333d7a485
共有 1 個文件被更改,包括 6 次插入2 次删除
  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)