From 9578ec4e5f0b8e8a65bcd5c3b21660465a1495ed Mon Sep 17 00:00:00 2001 From: Awiteb Date: Fri, 28 Jun 2024 19:12:47 +0300 Subject: [PATCH] fix: Create the vaults file if it's not exist Signed-off-by: Awiteb --- src/cli/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 1273472..fe3be4a 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -122,11 +122,16 @@ impl Cli { log::info!("Using the given vaults file"); if let Some(parent) = path.parent() { if parent.to_str() != Some("") && !parent.exists() { - log::info!("Creating the parent vaults file directory"); + log::info!( + "Creating the parent vaults file directory: {}", + parent.display() + ); fs::create_dir_all(parent)?; } } - fs::File::create(&path)?; + if !path.exists() { + fs::File::create(&path)?; + } path } else { log::info!("Using the default vaults file"); -- 2.45.2