Skip to content

Commit e858ea7

Browse files
Refactor bundle module (still reading only)
1 parent 6f534e2 commit e858ea7

File tree

6 files changed

+270
-166
lines changed

6 files changed

+270
-166
lines changed

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ uuid = { version = "1.11.0", features = ["v4", "serde"] }
1616
clap = { version = "4.5.20", features = ["derive"], optional = true }
1717
indicatif = { version = "0.17.9", features = ["tokio", "improved_unicode"], optional = true }
1818
futures-util = "0.3.31"
19+
countio = { version = "0.2.19", optional = true }
1920

2021
[lib]
2122
name = "ffbuildtool"
2223

2324
[features]
2425
default = ["lzma", "cli"]
25-
lzma = ["dep:rust-lzma"]
26+
lzma = ["dep:rust-lzma", "dep:countio"]
2627
cli = ["dep:clap", "dep:indicatif"]
2728

2829
[[bin]]

src/bin/ffbuildtool.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -328,11 +328,10 @@ async fn validate_build(args: ValidateBuildArgs) -> Result<(), Error> {
328328
async fn extract_bundle(args: ExtractBundleArgs) -> Result<(), Error> {
329329
use std::path::PathBuf;
330330

331-
use ffbuildtool::{bundle::AssetBundle, util};
332-
331+
let asset_bundle = ffbuildtool::bundle::AssetBundle::from_file(&args.bundle_path)?;
333332
let output_dir = args.output_dir.unwrap_or({
334-
let bundle_name = util::get_file_name_without_parent(&args.bundle_path);
335-
let bundle_name_url_encoded = util::url_encode(bundle_name);
333+
let bundle_name = ffbuildtool::util::get_file_name_without_parent(&args.bundle_path);
334+
let bundle_name_url_encoded = ffbuildtool::util::url_encode(bundle_name);
336335
let bundle_path = PathBuf::from(&args.bundle_path);
337336
bundle_path
338337
.parent()
@@ -341,9 +340,6 @@ async fn extract_bundle(args: ExtractBundleArgs) -> Result<(), Error> {
341340
.to_string_lossy()
342341
.to_string()
343342
});
344-
345343
println!("Extracting bundle {} to {}", args.bundle_path, output_dir);
346-
347-
let asset_bundle = AssetBundle::from_file(&args.bundle_path)?;
348344
asset_bundle.extract_files(&output_dir)
349345
}

0 commit comments

Comments
 (0)