From 752037da0e9e8da51cc44043c64b2931ce5cc5ce Mon Sep 17 00:00:00 2001 From: Toufic Batache <taffou2a@gmail.com> Date: Tue, 10 Oct 2023 14:25:13 +0200 Subject: [PATCH] Fix script --- src/scripts/clear_budget_simulations_cache.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/scripts/clear_budget_simulations_cache.ts b/src/scripts/clear_budget_simulations_cache.ts index cd02c3be1..820aaf0d5 100644 --- a/src/scripts/clear_budget_simulations_cache.ts +++ b/src/scripts/clear_budget_simulations_cache.ts @@ -19,12 +19,16 @@ if (fs.pathExistsSync(indexFilePath)) { // Remove every budget simulation from cache. const budgetsDir = path.join(simulationsBudgetDir, "responses") -if (fs.lstatSync(budgetsDir).isDirectory()) { - fs.removeSync(budgetsDir) +if (fs.pathExistsSync(budgetsDir)) { + if (fs.lstatSync(budgetsDir).isDirectory()) { + fs.removeSync(budgetsDir) + } } // Remove every test case simulation from cache. const testCasesDir = path.join(simulationsTestCasesDir, "responses") -if (fs.lstatSync(testCasesDir).isDirectory()) { - fs.removeSync(testCasesDir) +if (fs.pathExistsSync(testCasesDir)) { + if (fs.lstatSync(testCasesDir).isDirectory()) { + fs.removeSync(testCasesDir) + } } -- GitLab