unneeded path operations
This commit is contained in:
parent
c03cd0e905
commit
2273f881b2
@ -73,8 +73,7 @@ impl Loader{
|
|||||||
for (asset_id,render_config_id) in self.render_config_id_from_asset_id{
|
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();
|
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){
|
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(format!("textures/{}.dds",asset_id.0)){
|
||||||
if let Ok(mut file)=std::fs::File::open(path){
|
|
||||||
//TODO: parallel
|
//TODO: parallel
|
||||||
let mut data=Vec::<u8>::new();
|
let mut data=Vec::<u8>::new();
|
||||||
file.read_to_end(&mut data)?;
|
file.read_to_end(&mut data)?;
|
||||||
|
@ -40,10 +40,7 @@ impl MeshLoader{
|
|||||||
for (mesh_path,mesh_id) in &self.mesh_paths{
|
for (mesh_path,mesh_id) in &self.mesh_paths{
|
||||||
let mesh_path_lower=mesh_path.to_lowercase();
|
let mesh_path_lower=mesh_path.to_lowercase();
|
||||||
//.mdl, .vvd, .dx90.vtx
|
//.mdl, .vvd, .dx90.vtx
|
||||||
let mut path=std::path::PathBuf::from(mesh_path_lower.as_str());
|
let 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 mut vvd_path=path.clone();
|
let mut vvd_path=path.clone();
|
||||||
let mut vtx_path=path.clone();
|
let mut vtx_path=path.clone();
|
||||||
vvd_path.set_extension("vvd");
|
vvd_path.set_extension("vvd");
|
||||||
@ -89,8 +86,7 @@ impl Loader{
|
|||||||
for (texture_path,render_config_id) in self.render_config_loader.texture_paths{
|
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();
|
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){
|
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(format!("textures/{}.dds",texture_path)){
|
||||||
if let Ok(mut file)=std::fs::File::open(path){
|
|
||||||
//TODO: parallel
|
//TODO: parallel
|
||||||
let mut data=Vec::<u8>::new();
|
let mut data=Vec::<u8>::new();
|
||||||
file.read_to_end(&mut data)?;
|
file.read_to_end(&mut data)?;
|
||||||
|
Loading…
Reference in New Issue
Block a user