Skip to content

Commit

Permalink
fix(coffee): make sure network specific plugin path doesn't exist
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
tareknaser committed Feb 26, 2024
1 parent 70de208 commit 4060d6d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion coffee_core/src/coffee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}",
Expand Down

0 comments on commit 4060d6d

Please sign in to comment.