From 4060d6dbd01af1740db67bea75fc72268637e953 Mon Sep 17 00:00:00 2001 From: Tarek Date: Mon, 26 Feb 2024 23:37:15 +0200 Subject: [PATCH] fix(coffee): make sure network specific plugin path doesn't exist This commit checks that the destination path doesn't exist when we copy the plugin folder from the repositories folder to the destination network specific folder Signed-off-by: Tarek --- coffee_core/src/coffee.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/coffee_core/src/coffee.rs b/coffee_core/src/coffee.rs index 1bf247e..23a86a7 100644 --- a/coffee_core/src/coffee.rs +++ b/coffee_core/src/coffee.rs @@ -270,7 +270,15 @@ impl PluginManager for CoffeeManager { old_root_path, new_root_path ); - let script = format!("cp -r -T {old_root_path} {new_root_path}"); + + if fs::try_exists(new_root_path.clone()).await? { + log::debug!( + "A folder {} already exists. We should never reach this point", + new_root_path.clone() + ); + fs::remove_dir_all(new_root_path.clone()).await?; + } + let script = format!("cp -r {old_root_path} {new_root_path}"); sh!(self.config.root_path.clone(), script, verbose); log::debug!( "Done! copying directory from {} inside the new one {}",