Skip to content

Commit b4f3500

Browse files
committed
Support wildcard & globs for input files
1 parent 051ebf4 commit b4f3500

File tree

5 files changed

+221
-126
lines changed

5 files changed

+221
-126
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
- Provide SIMD implementation for the ECC encoder and decoder. This resulted in a speed-up of 10-15x for the ECC
1616
encoding and validation when decoding.
1717

18+
## Added
19+
20+
- Wildcard / Globbing support for the input files
21+
1822
## Fixes
1923

2024
- Fixed delta encoding bug of uncompressed chunks, where the direction was wrong on the encoder side (encoding "more"

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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ path = "src/main.rs"
2929
[dependencies]
3030
libtoa = { version = "0.2", default-features = false, features = ["std", "optimization"], path = "libtoa" }
3131
clap = { workspace = true }
32+
glob = "0.3"

src/compression.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{fs, fs::File, time::Instant};
1+
use std::{fs, fs::File, path::Path, time::Instant};
22

33
use libtoa::{TOAFileEncoder, TOAOptions, copy_wide};
44

@@ -30,9 +30,10 @@ fn calculate_block_size_exponent(file_size: u64, block_count: u64) -> Option<u8>
3030

3131
pub(crate) fn compress_file(
3232
cli: &Cli,
33+
input_path: &Path,
3334
output_path: &str,
3435
) -> std::io::Result<(u64, u64, std::time::Duration)> {
35-
let file_size = fs::metadata(&cli.input)?.len();
36+
let file_size = fs::metadata(input_path)?.len();
3637
let mut output_file = File::create(output_path)?;
3738

3839
let mut options = TOAOptions::from_preset(cli.preset);
@@ -78,7 +79,7 @@ pub(crate) fn compress_file(
7879

7980
options = options.with_error_correction(cli.ecc);
8081

81-
let mut toa_encoder = TOAFileEncoder::new(&cli.input, options, cli.threads)?;
82+
let mut toa_encoder = TOAFileEncoder::new(input_path, options, cli.threads)?;
8283

8384
let start_time = Instant::now();
8485

0 commit comments

Comments
 (0)