prepare to write files with TOKIO!!!

This commit is contained in:
Quaternions 2024-01-11 13:59:32 -08:00
parent e12c13a1dd
commit 00f4788169

View File

@ -117,7 +117,7 @@ async fn main()->AResult<()>{
write_template:!cli.no_template.unwrap_or(false), write_template:!cli.no_template.unwrap_or(false),
write_models:!cli.no_models.unwrap_or(false), write_models:!cli.no_models.unwrap_or(false),
write_scripts:!cli.no_scripts.unwrap_or(false), write_scripts:!cli.no_scripts.unwrap_or(false),
}), }).await,
Commands::DecompileHistoryIntoGit=>decompile_history_into_git(DecompileHistoryConfig{ Commands::DecompileHistoryIntoGit=>decompile_history_into_git(DecompileHistoryConfig{
git_committer_name:cli.git_committer_name.unwrap(), git_committer_name:cli.git_committer_name.unwrap(),
git_committer_email:cli.git_committer_email.unwrap(), git_committer_email:cli.git_committer_email.unwrap(),
@ -564,7 +564,7 @@ struct WriteConfig{
write_scripts:bool, write_scripts:bool,
} }
fn write_files(config:WriteConfig,mut context:DecompiledContext)->AResult<()>{ async fn write_files(config:WriteConfig,mut context:DecompiledContext)->AResult<()>{
let mut name_tally=std::collections::HashMap::<String,u32>::new(); let mut name_tally=std::collections::HashMap::<String,u32>::new();
let mut folder=config.output_folder.clone(); let mut folder=config.output_folder.clone();
let mut stack=vec![WriteStackInstruction::Node(context.tree_refs.get(&context.dom.root_ref()).unwrap(),0)]; let mut stack=vec![WriteStackInstruction::Node(context.tree_refs.get(&context.dom.root_ref()).unwrap(),0)];
@ -653,7 +653,7 @@ struct DecompileConfig{
write_scripts:bool, write_scripts:bool,
} }
fn decompile(config:DecompileConfig)->AResult<()>{ async fn decompile(config:DecompileConfig)->AResult<()>{
//rules: //rules:
//Class Script|LocalScript|ModuleScript->$Name.lua //Class Script|LocalScript|ModuleScript->$Name.lua
//Class Model->$Name.rbxmx //Class Model->$Name.rbxmx
@ -670,7 +670,7 @@ fn decompile(config:DecompileConfig)->AResult<()>{
write_template:config.write_template, write_template:config.write_template,
write_models:config.write_models, write_models:config.write_models,
write_scripts:config.write_scripts, write_scripts:config.write_scripts,
},context)?; },context).await?;
Ok(()) Ok(())
} }
@ -684,7 +684,7 @@ struct WriteCommitConfig{
write_scripts:bool, write_scripts:bool,
} }
fn write_commit(config:WriteCommitConfig,b:AResult<(AssetVersion,DecompiledContext)>,repo:&git2::Repository)->AResult<()>{ async fn write_commit(config:WriteCommitConfig,b:AResult<(AssetVersion,DecompiledContext)>,repo:&git2::Repository)->AResult<()>{
let (asset_version,context)=b?; let (asset_version,context)=b?;
//clean output dir //clean output dir
@ -709,7 +709,7 @@ fn write_commit(config:WriteCommitConfig,b:AResult<(AssetVersion,DecompiledConte
write_template:config.write_template, write_template:config.write_template,
write_models:config.write_models, write_models:config.write_models,
write_scripts:config.write_scripts, write_scripts:config.write_scripts,
},context)?; },context).await?;
let date=asset_version.created; let date=asset_version.created;
@ -789,7 +789,7 @@ async fn decompile_history_into_git(config:DecompileHistoryConfig)->AResult<()>{
write_template:config.write_template, write_template:config.write_template,
write_models:config.write_models, write_models:config.write_models,
write_scripts:config.write_scripts, write_scripts:config.write_scripts,
},b,&repo){ },b,&repo).await{
Ok(())=>(), Ok(())=>(),
Err(e)=>println!("download/unzip/decompile/write/commit error: {}",e), Err(e)=>println!("download/unzip/decompile/write/commit error: {}",e),
} }