From 2273f881b2ebcd404e400f0a3aded0661bb29389 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Sat, 17 Feb 2024 22:05:03 -0800 Subject: [PATCH] unneeded path operations --- src/roblox_legacy.rs | 3 +-- src/source_legacy.rs | 8 ++------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/roblox_legacy.rs b/src/roblox_legacy.rs index 5c67ffc..d4f70a2 100644 --- a/src/roblox_legacy.rs +++ b/src/roblox_legacy.rs @@ -73,8 +73,7 @@ impl Loader{ for (asset_id,render_config_id) in self.render_config_id_from_asset_id{ let render_config=self.render_configs.get_mut(render_config_id.get() as usize).unwrap(); if let (Some(asset_id),Some(texture_id))=(asset_id,render_config.texture){ - let path=std::path::PathBuf::from(format!("textures/{}.dds",asset_id.0)); - if let Ok(mut file)=std::fs::File::open(path){ + if let Ok(mut file)=std::fs::File::open(format!("textures/{}.dds",asset_id.0)){ //TODO: parallel let mut data=Vec::::new(); file.read_to_end(&mut data)?; diff --git a/src/source_legacy.rs b/src/source_legacy.rs index d24959f..efb2b3a 100644 --- a/src/source_legacy.rs +++ b/src/source_legacy.rs @@ -40,10 +40,7 @@ impl MeshLoader{ for (mesh_path,mesh_id) in &self.mesh_paths{ let mesh_path_lower=mesh_path.to_lowercase(); //.mdl, .vvd, .dx90.vtx - let mut path=std::path::PathBuf::from(mesh_path_lower.as_str()); - let file_name=std::path::PathBuf::from(path.file_stem().unwrap()); - path.pop(); - path.push(file_name); + let path=std::path::PathBuf::from(mesh_path_lower.as_str()); let mut vvd_path=path.clone(); let mut vtx_path=path.clone(); vvd_path.set_extension("vvd"); @@ -89,8 +86,7 @@ impl Loader{ for (texture_path,render_config_id) in self.render_config_loader.texture_paths{ let render_config=self.render_config_loader.render_configs.get_mut(render_config_id.get() as usize).unwrap(); if let (Some(texture_path),Some(texture_id))=(texture_path,render_config.texture){ - let path=std::path::PathBuf::from(format!("textures/{}.dds",texture_path)); - if let Ok(mut file)=std::fs::File::open(path){ + if let Ok(mut file)=std::fs::File::open(format!("textures/{}.dds",texture_path)){ //TODO: parallel let mut data=Vec::::new(); file.read_to_end(&mut data)?;