From 800491175b7c3db0eec19c81997d0e51fdd47771 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 28 Mar 2020 20:50:49 +0100 Subject: [PATCH] Avoid failing cleanup when a package gets uninstalled --- src/Composer/Downloader/FileDownloader.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index f94ec228b..bce1b7133 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -239,13 +239,13 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface if (file_exists($fileName)) { $this->filesystem->unlink($fileName); } - if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) { + if (is_dir($path) && $this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) { $this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/'); } - if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) { + if (is_dir($path) && $this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) { $this->filesystem->removeDirectory($this->config->get('vendor-dir')); } - if ($this->filesystem->isDirEmpty($path)) { + if (is_dir($path) && $this->filesystem->isDirEmpty($path)) { $this->filesystem->removeDirectory($path); } }