diff --git a/repak/src/footer.rs b/repak/src/footer.rs index e3280ac..f2298bc 100644 --- a/repak/src/footer.rs +++ b/repak/src/footer.rs @@ -89,8 +89,17 @@ impl Footer { ver if ver < Version::V8B => 4, _ => 5, }; - for _ in 0..algo_size { - writer.write_all(&[0; 32])?; + // TODO: handle if compression.len() > algo_size + for i in 0..algo_size { + let mut name = [0; 32]; + if let Some(algo) = self.compression.get(i) { + if algo != &Compression::None { + for (i, b) in algo.to_string().as_bytes().iter().enumerate() { + name[i] = *b; + } + } + } + writer.write_all(&name)?; } Ok(()) } diff --git a/repak/src/pak.rs b/repak/src/pak.rs index cdc161f..cdfe383 100644 --- a/repak/src/pak.rs +++ b/repak/src/pak.rs @@ -23,6 +23,7 @@ pub struct Pak { version: Version, mount_point: String, index: Index, + compression: Vec, } impl Pak { @@ -31,6 +32,7 @@ impl Pak { version, mount_point, index: Index::new(path_hash_seed), + compression: vec![], } } } @@ -310,6 +312,7 @@ impl Pak { version, mount_point, index, + compression: footer.compression, }) } @@ -440,7 +443,7 @@ impl Pak { index_size: index_buf.len() as u64, hash: index_hash, frozen: false, - compression: vec![], + compression: self.compression.clone(), // TODO: avoid this clone }; footer.write(writer)?;