From 6774e7ee291f075f3d158d71f24780c53ae7e3f6 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sat, 16 Jan 2021 22:45:41 +0100 Subject: [PATCH] Filesystem: use fast operation first in emptyDirectory() --- src/Composer/Util/Filesystem.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Composer/Util/Filesystem.php b/src/Composer/Util/Filesystem.php index d1200dde9..0c0309c55 100644 --- a/src/Composer/Util/Filesystem.php +++ b/src/Composer/Util/Filesystem.php @@ -63,7 +63,7 @@ class Filesystem public function emptyDirectory($dir, $ensureDirectoryExists = true) { - if (file_exists($dir) && is_link($dir)) { + if (is_link($dir) && file_exists($dir)) { $this->unlink($dir); } @@ -600,7 +600,7 @@ class Filesystem if (!function_exists('symlink')) { return false; } - + $cwd = getcwd(); $relativePath = $this->findShortestPath($link, $target);