[READ-ONLY] Mirror of https://github.com/probablykasper/time-machine-inspector. Time Machine backup size inspector app
backup macos tauri time-machine
0

Configure Feed

Select the types of activity you want to include in your feed.

Fix `No parent of path` error, closes #4

Kasper (Jul 9, 2022, 8:51 PM +0200) 50ccaffb 6ea7593f

+27 -1
+27 -1
src-tauri/src/listbackups.rs
··· 20 20 21 21 let output_str = parse_output(output.stdout)?; 22 22 23 - let paths = output_str 23 + let mut paths: Vec<String> = output_str 24 24 .split('\n') 25 25 .map(|s| s.to_string()) 26 26 .filter(|s| s != "") 27 27 .collect(); 28 + 29 + let mut machine_dir = None; 30 + for path in &mut paths { 31 + if path.starts_with("/") { 32 + continue; 33 + } 34 + match &machine_dir { 35 + None => { 36 + println!("tmutil machinedirectory"); 37 + let output = Command::new("tmutil") 38 + .arg("machinedirectory") 39 + .output() 40 + .expect("Error calling command"); 41 + check_cmd_success(&output.status, output.stderr.clone())?; 42 + println!("Success getting machinedirectory"); 43 + let output_str = parse_output(output.stdout)?; 44 + machine_dir = Some(output_str); 45 + } 46 + Some(machine_dir) => { 47 + *path = machine_dir.to_string() + "/" + &path; 48 + } 49 + } 50 + } 51 + if let Some(path0) = paths.get(0) { 52 + if path0.starts_with("/") {} 53 + } 28 54 29 55 let dir_map = DirMap::from_string_paths(paths)?; 30 56 Ok(dir_map)