diff --git a/src/main.rs b/src/main.rs index ef42af5..2e4abd2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -246,6 +246,7 @@ fn download_textures(paths:Vec)->AResult<()>{ } let texture_list_string=texture_list.into_iter().map(|id|id.to_string()).collect::>(); println!("Texture list:{:?}",texture_list_string.join(" ")); + std::fs::create_dir_all("textures/unprocessed")?; let output=std::process::Command::new("asset-tool") .args(["download","--cookie-literal","","--output-folder","textures/unprocessed/"]) .args(texture_list_string) @@ -281,6 +282,7 @@ fn download_meshes(paths:Vec)->AResult<()>{ } let mesh_list_string=mesh_list.into_iter().map(|id|id.to_string()).collect::>(); println!("Mesh list:{:?}",mesh_list_string.join(" ")); + std::fs::create_dir_all("meshes/")?; let output=std::process::Command::new("asset-tool") .args(["download","--cookie-literal","","--output-folder","meshes/"]) .args(mesh_list_string) @@ -333,7 +335,7 @@ fn convert(file_thing:std::fs::DirEntry) -> AResult<()>{ )?; //write dds - let mut dest=PathBuf::from("textures/dds"); + let mut dest=PathBuf::from("textures"); dest.push(file_thing.file_name()); dest.set_extension("dds"); let mut writer = std::io::BufWriter::new(std::fs::File::create(dest)?); @@ -355,6 +357,8 @@ fn convert(file_thing:std::fs::DirEntry) -> AResult<()>{ Ok(()) } fn convert_textures() -> AResult<()>{ + std::fs::create_dir_all("textures/unprocessed")?; + std::fs::create_dir_all("textures/processed")?; let start = std::time::Instant::now(); let mut threads=Vec::new(); for entry in std::fs::read_dir("textures/unprocessed")? { @@ -501,6 +505,7 @@ fn recursive_vmt_loaderAResult>>>(find_stuff:&F,ma } fn extract_textures(paths:Vec,vpk_paths:Vec)->AResult<()>{ + std::fs::create_dir_all("textures")?; let vpk_list:Vec=vpk_paths.into_iter().map(|vpk_path|vpk::VPK::read(&vpk_path).expect("vpk file does not exist")).collect(); for path in paths{ let mut deduplicate=std::collections::HashSet::new(); @@ -569,7 +574,7 @@ fn extract_textures(paths:Vec,vpk_paths:Vec)->AResult<()>{ )?; //write dds - let mut dest=PathBuf::from("textures/dds"); + let mut dest=PathBuf::from("textures"); dest.push(write_file_name); dest.set_extension("dds"); std::fs::create_dir_all(dest.parent().unwrap())?;