Added .exists() for URI

This commit is contained in:
G2-Games 2024-02-09 23:23:08 -06:00
parent 4a7a6096d6
commit 96069fd9bc

View file

@ -460,6 +460,14 @@ impl URI {
}; };
path_str.to_string() path_str.to_string()
} }
pub fn exists(&self) -> Result<bool, std::io::Error> {
match self {
URI::Local(loc) => loc.try_exists(),
URI::Cue {location, ..} => location.try_exists(),
URI::Remote(_, _loc) => todo!(),
}
}
} }
impl ToString for URI { impl ToString for URI {
@ -699,7 +707,7 @@ impl MusicLibrary {
Ok(_) => total += 1, Ok(_) => total += 1,
Err(_error) => { Err(_error) => {
errors += 1; errors += 1;
println!("{}, {:?}: {}", format, target_file.file_name(), _error) //println!("{}, {:?}: {}", format, target_file.file_name(), _error)
} // TODO: Handle more of these errors } // TODO: Handle more of these errors
}; };
} else if extension == "cue" { } else if extension == "cue" {
@ -707,15 +715,13 @@ impl MusicLibrary {
Ok(added) => added, Ok(added) => added,
Err(error) => { Err(error) => {
errors += 1; errors += 1;
println!("{}", error); //println!("{}", error);
0 0
} }
} }
} }
} }
println!("ERRORS: {}", errors);
Ok(total) Ok(total)
} }