Format
This commit is contained in:
parent
a31eb7a3cc
commit
22252a7eea
41
src/main.rs
41
src/main.rs
|
|
@ -1,16 +1,16 @@
|
|||
use std::fs::File;
|
||||
use std::{fs, io, sync::Arc};
|
||||
use std::path::{Path, PathBuf};
|
||||
use flate2::read::GzDecoder;
|
||||
use tar::Archive;
|
||||
use std::collections::HashMap;
|
||||
use std::ffi::OsStr;
|
||||
use std::fs::File;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::{fs, io, sync::Arc};
|
||||
use tar::Archive;
|
||||
|
||||
use clap::Parser;
|
||||
use rayon::prelude::*;
|
||||
use std::io::prelude::*;
|
||||
use std::io::BufReader;
|
||||
use std::process::Command;
|
||||
use rayon::prelude::*;
|
||||
use clap::Parser;
|
||||
|
||||
/// Program for unpacking unitypackages files.
|
||||
#[derive(Parser, Debug)]
|
||||
|
|
@ -25,7 +25,7 @@ struct Args {
|
|||
|
||||
/// optional- path to the tool that will auto convert fbx files to gltf during unpacking
|
||||
#[arg(short, long)]
|
||||
fbx_to_gltf: Option<PathBuf>
|
||||
fbx_to_gltf: Option<PathBuf>,
|
||||
}
|
||||
|
||||
pub fn extract_archive(archive_path: &Path, extract_to: &Path) -> io::Result<()> {
|
||||
|
|
@ -101,7 +101,11 @@ fn main() {
|
|||
|
||||
if args.fbx_to_gltf.is_some() {
|
||||
if let Some("fbx") = path.extension().and_then(OsStr::to_str) {
|
||||
process_fbx_file(&source_asset, &result_path, &args.fbx_to_gltf.clone().unwrap());
|
||||
process_fbx_file(
|
||||
&source_asset,
|
||||
&result_path,
|
||||
&args.fbx_to_gltf.clone().unwrap(),
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -127,10 +131,25 @@ fn main() {
|
|||
|
||||
fn process_fbx_file(source_asset: &Path, result_path: &Path, tool: &PathBuf) {
|
||||
let out_path = result_path.with_extension("");
|
||||
println!("{:?}", &["--input", source_asset.to_str().unwrap(), "--output", out_path.to_str().unwrap()]);
|
||||
println!(
|
||||
"{:?}",
|
||||
&[
|
||||
"--input",
|
||||
source_asset.to_str().unwrap(),
|
||||
"--output",
|
||||
out_path.to_str().unwrap()
|
||||
]
|
||||
);
|
||||
let output = Command::new(tool)
|
||||
.args(["--input", source_asset.to_str().unwrap(), "-b", "--output", out_path.to_str().unwrap()])
|
||||
.output().unwrap();
|
||||
.args([
|
||||
"--input",
|
||||
source_asset.to_str().unwrap(),
|
||||
"-b",
|
||||
"--output",
|
||||
out_path.to_str().unwrap(),
|
||||
])
|
||||
.output()
|
||||
.unwrap();
|
||||
let output_result = String::from_utf8_lossy(&output.stdout);
|
||||
println!("output: {}", output_result);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue