From 81a360519ec97e63c542bef6cc69f1707198c81f Mon Sep 17 00:00:00 2001 From: Awiteb Date: Fri, 28 Jun 2024 18:24:41 +0200 Subject: [PATCH] fix: Create the vaults file if it's not exist (#60) Reviewed-on: https://git.4rs.nl/awiteb/lprs/pulls/60 Co-authored-by: Awiteb Co-committed-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");