Просмотр исходного кода

Handle files in Filesystem::copyThenRemove, fixes #3287

Jordi Boggiano 10 лет назад
Родитель
Сommit
2c237fdfdf
1 измененных файлов с 7 добавлено и 0 удалено
  1. 7 0
      src/Composer/Util/Filesystem.php

+ 7 - 0
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);