diff --git a/src/Composer/Downloader/ArchiveDownloader.php b/src/Composer/Downloader/ArchiveDownloader.php index 7788397f2..dd29bb323 100644 --- a/src/Composer/Downloader/ArchiveDownloader.php +++ b/src/Composer/Downloader/ArchiveDownloader.php @@ -137,9 +137,18 @@ abstract class ArchiveDownloader extends FileDownloader }; $renameAsOne = false; - if (!file_exists($path) || ($filesystem->isDirEmpty($path) && $filesystem->removeDirectoryPhp($path))) { + if (!file_exists($path)) { $renameAsOne = true; } + if ($filesystem->isDirEmpty($path)) { + try { + if ($filesystem->removeDirectoryPhp($path)) { + $renameAsOne = true; + } + } catch (\RuntimeException $e) { + // ignore error, and simply do not renameAsOne + } + } $contentDir = $getFolderContent($temporaryDir); $singleDirAtTopLevel = 1 === count($contentDir) && is_dir(reset($contentDir));