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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user