From bbab355c12e0767780cf0fb23d7b2d1070ba17a0 Mon Sep 17 00:00:00 2001 From: Fontrodona Nicolas <nicolas.fontrodona@ens-lyon.fr> Date: Tue, 10 May 2022 15:33:13 +0200 Subject: [PATCH] src/init.rs: add results check in get_borg_folder function --- src/init.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/init.rs b/src/init.rs index d80fdcd..0e7d979 100644 --- a/src/init.rs +++ b/src/init.rs @@ -31,16 +31,16 @@ pub fn get_borg_folder() -> (PathBuf, PathBuf) { let mut results = p.clone(); p.push(".borg"); results.push("results"); + if !results.is_dir() { + eprintln!("{} not found !", results.to_str().unwrap()); + exit(1); + } (p, results) } /// Creation of a borg repository in the same directory as the .git repository pub fn init_repository() { - let (borg_path, results) = get_borg_folder(); - if !results.is_dir() { - eprintln!("{} not found !", results.to_str().unwrap()); - exit(1); - } + let (borg_path, _) = get_borg_folder(); let output = Command::new("borg") .arg("init") .arg("--encryption=none") -- GitLab