mirror of
https://github.com/xavo95/repak.git
synced 2025-01-18 10:54:38 +00:00
Fix compression algos not being written
This commit is contained in:
parent
9692c7a4d1
commit
8fddd3961f
2 changed files with 15 additions and 3 deletions
|
@ -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(())
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ pub struct Pak {
|
|||
version: Version,
|
||||
mount_point: String,
|
||||
index: Index,
|
||||
compression: Vec<super::Compression>,
|
||||
}
|
||||
|
||||
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)?;
|
||||
|
|
Loading…
Reference in a new issue