Frodo45127 / rpfm

Rusted PackFile Manager (RPFM) is a... reimplementation in Rust and Qt5 of PackFile Manager (PFM), one of the best modding tools for Total War Games.
MIT License
368 stars 58 forks source link

Fix extracting folders / files from CLI #219

Closed bapplebo closed 1 year ago

bapplebo commented 2 years ago

I was playing around with the CLI and noticed that exporting files / folders didn't work as expected. Here's a short summary of my investigation - it seems that Rust's iterator .enumerate() starts from the pointer, not the whole Iterator?

let destination_path = values.next().unwrap(); 
// .next() called, so values now points to the first packed_file_path 
let packed_file_paths = values.enumerate().filter(|(x, _)| x != &0).map(|(_, y)| y).collect::<Vec<&str>>(); 
// the .filter call will filter out the item at index 0, which will be the first packed file path

Just got a random mod and did some testing:

Folders:

cargo run -- -g warhammer_3 -p <path-to-packfile> -vvv packfile -E <destination> db
cargo run -- -g warhammer_3 -p <path-to-packfile> -vvv packfile -E <destination> db scripts

Files:

cargo run -- -g warhammer_3 -p <path-to-packfile> -vvv packfile -e <destination> db/_kv_rules_tables/!ccextreme db/_kv_unit_ability_scaling_rules_tables/!ccextreme

There's also a small fix as the CLI library can't seem to find "asskit_db_path" as it references "assdb" (main.rs, L49).

Also from my end, I'm not 100% sure if the CLI is used in the main app at all and if that breaks anything there - if so, please feel free to disregard this PR!

Frodo45127 commented 1 year ago

While I appreciate the pr, the cli tool has been rewritten from scratch for 4.0 (you can check it in the v4_rework branch, and soon in the develop branch too) making this no longer applicable, and there are no plans to get another 3.X release out.

So... thanks for the PR, but I'm afraid I'll have to close it without merging it.