diff --git a/src/main.rs b/src/main.rs index 19dfddf..ed99039 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1197,11 +1197,11 @@ impl Query for QueryTriplet{ } } -async fn discern_node(search_path:&std::path::PathBuf,search_name:&str,style:Option)->AResult{ +async fn discern_node(search_path:&std::path::PathBuf,search_name:&str,style:Option)->AResult>{ let mut contents_folder=search_path.clone(); contents_folder.push(search_name); //folder - if let Ok(dir)=tokio::fs::read_dir(contents_folder.as_path()).await{ + Ok(if let Ok(dir)=tokio::fs::read_dir(contents_folder.as_path()).await{ //scan inside the folder for an object to define the class of the folder let (script_file,model_file)=tokio::join!( async {match style{ @@ -1220,7 +1220,7 @@ async fn discern_node(search_path:&std::path::PathBuf,search_name:&str,style:Opt get_file_async(contents_folder.clone(),format!("{}.rbxmx",search_name)) ); //model? script? both? - Ok(match (script_file,model_file){ + Some(match (script_file,model_file){ (Ok(mut file),Err(QueryResolveError::NotFound))=>{ //read entire file let mut buf=String::new(); @@ -1249,8 +1249,9 @@ async fn discern_node(search_path:&std::path::PathBuf,search_name:&str,style:Opt |(_,Err(e))=>Err(e)? }) }else{ - Err(anyhow::Error::msg("message")) - } + //a folder of this name does not exist + None + }) } enum CompileClass{ @@ -1301,7 +1302,9 @@ async fn compile(config:CompileConfig)->AResult<()>{ CompileStackInstruction::Referent(item_ref)=>{ let item=dom.get_by_ref(item_ref).ok_or(anyhow::Error::msg("null child ref"))?; //check if item exists in folder or subfolder of same name - if let Ok(obj)=discern_node(&folder,item.name.as_str(),None).await{ + todo!("this is totally unnecessary, + only the folder needs to exist to determine if traversal should continue"); + if let Some(obj)=discern_node(&folder,item.name.as_str(),None).await?{ //cool }else{ //determine if this is ok