stop failing when maps are corrupted while downloading textures

This commit is contained in:
Quaternions 2023-09-29 03:14:29 -07:00
parent 01524146c7
commit de7b0bd5cc

View File

@ -261,12 +261,11 @@ fn download_textures(paths: Vec<std::path::PathBuf>) -> BoxResult<()>{
]; ];
let mut texture_list=std::collections::HashSet::new(); let mut texture_list=std::collections::HashSet::new();
for path in paths { for path in paths {
let input = std::io::BufReader::new(std::fs::File::open(path)?); let input = std::io::BufReader::new(std::fs::File::open(path.clone())?);
let dom = rbx_binary::from_reader(input)?;
match rbx_binary::from_reader(input){
Ok(dom)=>{
let object_refs = get_texture_refs(&dom); let object_refs = get_texture_refs(&dom);
for &object_ref in object_refs.iter() { for &object_ref in object_refs.iter() {
if let Some(object)=dom.get_by_ref(object_ref){ if let Some(object)=dom.get_by_ref(object_ref){
if let Some(rbx_dom_weak::types::Variant::Content(content)) = object.properties.get("Texture") { if let Some(rbx_dom_weak::types::Variant::Content(content)) = object.properties.get("Texture") {
@ -277,6 +276,9 @@ fn download_textures(paths: Vec<std::path::PathBuf>) -> BoxResult<()>{
} }
} }
} }
},
Err(e)=>println!("error loading map {:?}: {:?}",path.file_name(),e),
}
} }
println!("Texture list:{:?}",texture_list); println!("Texture list:{:?}",texture_list);
let processes_result:Result<Vec<_>, _>=texture_list.iter().map(|asset_id|{ let processes_result:Result<Vec<_>, _>=texture_list.iter().map(|asset_id|{