diff --git a/src/Cleanup.php b/src/Cleanup.php index d53675ec..1f1f2241 100644 --- a/src/Cleanup.php +++ b/src/Cleanup.php @@ -68,6 +68,14 @@ public function cleanup(array $sourceFiles): void if (is_link($absolutePath)) { unlink($absolutePath); } + /** + * `unlink()` will not work on Windows. `rimdir()` will not work if there are files in the directory. + * + * @see https://stackoverflow.com/a/18262809/336146 + */ + if (false !== strpos('WIN', PHP_OS)) { + @rmdir($absolutePath); + } if ($absolutePath !== realpath($absolutePath)) { continue;