Format
This commit is contained in:
parent
f68aeca902
commit
30626bab1f
|
|
@ -225,7 +225,7 @@ checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lwa_unity_unpack"
|
name = "lwa_unity_unpack"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"flate2",
|
"flate2",
|
||||||
|
|
|
||||||
14
src/main.rs
14
src/main.rs
|
|
@ -41,8 +41,8 @@ pub fn extract_archive(archive_path: &Path, extract_to: &Path) -> io::Result<()>
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args : Args = Args::parse();
|
let args: Args = Args::parse();
|
||||||
let ignored_extensions = args.ignore_extensions.unwrap_or(vec![]);
|
let ignored_extensions = args.ignore_extensions.unwrap_or_default();
|
||||||
let archive_path = Path::new(&args.input);
|
let archive_path = Path::new(&args.input);
|
||||||
let tmp_dir = Path::new("./tmp_dir");
|
let tmp_dir = Path::new("./tmp_dir");
|
||||||
let output_dir = Path::new(&args.output);
|
let output_dir = Path::new(&args.output);
|
||||||
|
|
@ -68,7 +68,7 @@ fn main() {
|
||||||
let root_file = entry.path();
|
let root_file = entry.path();
|
||||||
let asset = entry.file_name().into_string().unwrap();
|
let asset = entry.file_name().into_string().unwrap();
|
||||||
if root_file.is_dir() {
|
if root_file.is_dir() {
|
||||||
let mut real_path= String::new() ;
|
let mut real_path = String::new();
|
||||||
let mut extension = None;
|
let mut extension = None;
|
||||||
let mut has_asset = false;
|
let mut has_asset = false;
|
||||||
for sub_entry in fs::read_dir(root_file.clone()).unwrap() {
|
for sub_entry in fs::read_dir(root_file.clone()).unwrap() {
|
||||||
|
|
@ -82,17 +82,19 @@ fn main() {
|
||||||
match line {
|
match line {
|
||||||
Some(Ok(path)) => {
|
Some(Ok(path)) => {
|
||||||
real_path = path;
|
real_path = path;
|
||||||
if let Some(e) = Path::new(&real_path).extension().and_then(OsStr::to_str) {
|
if let Some(e) =
|
||||||
|
Path::new(&real_path).extension().and_then(OsStr::to_str)
|
||||||
|
{
|
||||||
extension = Some(String::from(e));
|
extension = Some(String::from(e));
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
_ => continue,
|
_ => continue,
|
||||||
}
|
}
|
||||||
} else if file_name == "asset" {
|
} else if file_name == "asset" {
|
||||||
has_asset = true;
|
has_asset = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if has_asset && !ignored_extensions.contains(&extension.unwrap_or_default()){
|
if has_asset && !ignored_extensions.contains(&extension.unwrap_or_default()) {
|
||||||
mapping.insert(asset, real_path);
|
mapping.insert(asset, real_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue