panic lol

This commit is contained in:
Quaternions 2023-09-12 17:02:05 -07:00
parent e0e8744bfd
commit cad29af4bb

View File

@ -270,7 +270,6 @@ enum Interactive{
Passed, Passed,
Blocked, Blocked,
Flagged, Flagged,
ReplaceFailed,
} }
enum ScriptAction { enum ScriptAction {
Pass, Pass,
@ -387,8 +386,7 @@ fn interactive() -> Result<(), Box<dyn std::error::Error>>{
println!("replaced source id={} location={}",replace_id,location); println!("replaced source id={} location={}",replace_id,location);
replace_script.properties.insert("Source".to_string(), rbx_dom_weak::types::Variant::String(replace_source.clone())); replace_script.properties.insert("Source".to_string(), rbx_dom_weak::types::Variant::String(replace_source.clone()));
}else{ }else{
println!("failed to get replacement source id={} location={}",replace_id,location); panic!("failed to get replacement source id={} location={}",replace_id,location);
fail_type=Interactive::ReplaceFailed;
} }
} }
ScriptAction::Flag => { ScriptAction::Flag => {
@ -403,13 +401,14 @@ fn interactive() -> Result<(), Box<dyn std::error::Error>>{
} }
}, },
} }
}else{
panic!("script source property is none!");
} }
} }
let mut dest=match fail_type{ let mut dest=match fail_type{
Interactive::Passed => std::path::PathBuf::from("maps/processed"),//write map into maps/processed Interactive::Passed => std::path::PathBuf::from("maps/processed"),//write map into maps/processed
Interactive::Blocked => std::path::PathBuf::from("maps/blocked"),//write map into maps/blocked Interactive::Blocked => std::path::PathBuf::from("maps/blocked"),//write map into maps/blocked
Interactive::Flagged => std::path::PathBuf::from("maps/flagged"),//write map into maps/flagged Interactive::Flagged => std::path::PathBuf::from("maps/flagged"),//write map into maps/flagged
Interactive::ReplaceFailed => continue,//do nothing, map is still unprocessed
}; };
dest.push(file_thing.file_name()); dest.push(file_thing.file_name());
std::fs::rename(file_thing.path(), dest)?; std::fs::rename(file_thing.path(), dest)?;