From 5cfb962c2c5d8164a586e06aec4e446c5d9d7ecd Mon Sep 17 00:00:00 2001 From: Frederik Bosch Date: Fri, 23 Aug 2024 13:51:09 +0200 Subject: [PATCH] only remove scan file if it exists --- bin/auradi | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/auradi b/bin/auradi index aa9c7b9..4832613 100755 --- a/bin/auradi +++ b/bin/auradi @@ -58,13 +58,14 @@ if ($command === 'scan') { echo 'Found ' . count($classMapPaths) . ' classmap paths' . PHP_EOL; echo PHP_EOL; - if (in_array('--force', $args, true)) { - unlink($currentCwd . '/vendor/aura.di.scan.json'); + $resultFile = $currentCwd . '/vendor/aura.di.scan.json'; + if (in_array('--force', $args, true) && is_file($resultFile)) { + unlink($resultFile); } $generator = new CachedFileGenerator( new ComposerMapGenerator($classMapPaths, $currentCwd), - $currentCwd . '/vendor/aura.di.scan.json', + $resultFile ); echo 'Scanning paths for classes and annotations.' . PHP_EOL;