Skip to content
Snippets Groups Projects
Commit 25f5655e authored by nfontrod's avatar nfontrod
Browse files

src/commit.rs: add check_path function

parent ff3036b9
No related branches found
No related tags found
No related merge requests found
use crate::init;
use std::process::{exit, Command};
use std::{process::{exit, Command}, path::PathBuf};
/// Check if .borg repository and results folder exists
pub fn check_path() -> (PathBuf, PathBuf) {
let (borg_folder, results_folder) = init::get_borg_folder();
if !borg_folder.is_dir() {
eprintln!("{} folder not found !", borg_folder.to_str().unwrap());
exit(2)
}
(borg_folder, results_folder)
}
/// Get the current commit name of a git repository
///
......@@ -26,7 +38,7 @@ pub fn get_current_commit() -> String {
/// Create a commit of the results folder named as the current git commit id
pub fn commit(compression: String) {
let (borg_folder, results_folder) = init::get_borg_folder();
let (borg_folder, results_folder) = check_path();
let commit = get_current_commit();
let output = Command::new("borg")
.arg("create")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment