forked from StrafesNET/asset-tool
set file extension for known file types using fourcc
This commit is contained in:
parent
8e933111e4
commit
01c61c71d9
@ -205,7 +205,6 @@ async fn main()->AResult<()>{
|
|||||||
subcommand.asset_ids.into_iter().map(|asset_id|{
|
subcommand.asset_ids.into_iter().map(|asset_id|{
|
||||||
let mut path=output_folder.clone();
|
let mut path=output_folder.clone();
|
||||||
path.push(asset_id.to_string());
|
path.push(asset_id.to_string());
|
||||||
path.set_extension("rbxm");
|
|
||||||
(asset_id,path)
|
(asset_id,path)
|
||||||
}).collect()
|
}).collect()
|
||||||
).await
|
).await
|
||||||
@ -342,7 +341,13 @@ async fn download_list(cookie:String,asset_id_file_map:AssetIDFileMap)->AResult<
|
|||||||
.buffer_unordered(CONCURRENT_REQUESTS)
|
.buffer_unordered(CONCURRENT_REQUESTS)
|
||||||
.for_each(|b:AResult<_>|async{
|
.for_each(|b:AResult<_>|async{
|
||||||
match b{
|
match b{
|
||||||
Ok((dest,data))=>{
|
Ok((mut dest,data))=>{
|
||||||
|
//known file types
|
||||||
|
match &data[0..4]{
|
||||||
|
b"<rob"=>dest.set_extension("rbxm"),
|
||||||
|
b"\x89PNG"=>dest.set_extension("png"),
|
||||||
|
_=>false,
|
||||||
|
};
|
||||||
match tokio::fs::write(dest,data).await{
|
match tokio::fs::write(dest,data).await{
|
||||||
Err(e)=>eprintln!("fs error: {}",e),
|
Err(e)=>eprintln!("fs error: {}",e),
|
||||||
_=>(),
|
_=>(),
|
||||||
|
Loading…
Reference in New Issue
Block a user