feat(08-01): update format.rs for v1.1 TOC entry layout
- Bump VERSION constant from 1 to 2 - Add entry_type (u8) and permissions (u16) fields to TocEntry struct - Update write_toc_entry/read_toc_entry for new field order after name - Update entry_size formula from 101 to 104 + name_length - Update all unit tests for v1.1 layout (new fields, version 2, sizes) - Add placeholder entry_type/permissions to archive.rs ProcessedFile for compilation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,8 @@ use crate::key::KEY;
|
||||
/// Processed file data collected during Pass 1 of pack.
|
||||
struct ProcessedFile {
|
||||
name: String,
|
||||
entry_type: u8, // 0x00 = file, 0x01 = directory
|
||||
permissions: u16, // Lower 12 bits of POSIX mode_t
|
||||
original_size: u32,
|
||||
compressed_size: u32,
|
||||
encrypted_size: u32,
|
||||
@@ -114,6 +116,8 @@ pub fn pack(files: &[PathBuf], output: &Path, no_compress: &[String]) -> anyhow:
|
||||
|
||||
processed.push(ProcessedFile {
|
||||
name,
|
||||
entry_type: 0,
|
||||
permissions: 0o644,
|
||||
original_size,
|
||||
compressed_size,
|
||||
encrypted_size,
|
||||
@@ -142,6 +146,8 @@ pub fn pack(files: &[PathBuf], output: &Path, no_compress: &[String]) -> anyhow:
|
||||
.iter()
|
||||
.map(|pf| TocEntry {
|
||||
name: pf.name.clone(),
|
||||
entry_type: pf.entry_type,
|
||||
permissions: pf.permissions,
|
||||
original_size: pf.original_size,
|
||||
compressed_size: pf.compressed_size,
|
||||
encrypted_size: pf.encrypted_size,
|
||||
@@ -179,6 +185,8 @@ pub fn pack(files: &[PathBuf], output: &Path, no_compress: &[String]) -> anyhow:
|
||||
.enumerate()
|
||||
.map(|(i, pf)| TocEntry {
|
||||
name: pf.name.clone(),
|
||||
entry_type: pf.entry_type,
|
||||
permissions: pf.permissions,
|
||||
original_size: pf.original_size,
|
||||
compressed_size: pf.compressed_size,
|
||||
encrypted_size: pf.encrypted_size,
|
||||
|
||||
Reference in New Issue
Block a user