/**
  * @param \Composer\Package\PackageInterface $initial
  * @param \Composer\Package\PackageInterface $target
  */
 protected function updateCode(\Composer\Package\PackageInterface $initial, \Composer\Package\PackageInterface $target)
 {
     // Currently the install path for all versions is the same.
     // In the future the install path for two core versions may differ.
     $initialDownloadPath = $this->getInstallPath($initial);
     $targetDownloadPath = $this->getInstallPath($target);
     if ($targetDownloadPath !== $initialDownloadPath) {
         // if the target and initial dirs intersect, we force a remove + install
         // to avoid the rename wiping the target dir as part of the initial dir cleanup
         if (substr($initialDownloadPath, 0, strlen($targetDownloadPath)) === $targetDownloadPath || substr($targetDownloadPath, 0, strlen($initialDownloadPath)) === $initialDownloadPath) {
             $this->removeCode($initial);
             $this->installCode($target);
             return;
         }
         $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
     }
     $this->downloadManager->update($initial, $target, $targetDownloadPath);
 }