diff --git a/src/Composer/Util/Filesystem.php b/src/Composer/Util/Filesystem.php index 182004205..6044c25d6 100644 --- a/src/Composer/Util/Filesystem.php +++ b/src/Composer/Util/Filesystem.php @@ -234,6 +234,13 @@ class Filesystem */ public function copyThenRemove($source, $target) { + if (!is_dir($source)) { + copy($source, $target); + $this->unlink($source); + + return; + } + $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS); $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST); $this->ensureDirectoryExists($target);