added a function to print the sharpersist

command to add a scheduled task!

also updated it so that it creates a backup
of your projects.conf file incase the working one
gets corrupted somehow.
This commit is contained in:
pyro57000
2025-05-05 13:36:23 -05:00
parent 0913703976
commit 4e38749c86
4 changed files with 47 additions and 0 deletions

View File

@@ -293,6 +293,15 @@ pub fn get_projects(config_path: &PathBuf, show: bool) -> Vec<Project>{
let mut mut_config_path = config_path.clone();
mut_config_path.pop();
mut_config_path.push("projects.conf");
let mut bkup_config_path = mut_config_path.clone();
bkup_config_path.pop();
bkup_config_path.push("projects.conf.bkup");
let bkup_result = fs::copy(&mut_config_path, &bkup_config_path);
if bkup_result.is_err(){
let error = bkup_result.err().unwrap();
println!("error backing up the projects.conf file!");
println!("error: {}", error);
}
let mut projects = Vec::new();
let projects_string = fs::read_to_string(mut_config_path).expect("error reading projects file");
let project_lines:Vec<&str> = projects_string.split("\n").collect();