Open
Description
I have a use case where I need to create a debian-like package format.
In a nutshell, I have to create a tar file with the following entries structure:
/./
- /./manifest
- /./control
where the root entry is indeed named .
Is there a way to create this (valid) tar file with tar-rs
?
I tried different ways but failed.
What I expected to work was the following:
fn create_tar_gz(filepath: &Path, dir: &Path) -> io::Result<()> {
let archive = std::fs::File::create(filepath)?;
let enc = GzEncoder::new(archive, Compression::default());
let mut tar = tar::Builder::new(enc);
tar.append_dir_all("./.", dir)?;
tar.finish()?;
Ok(())
However, it creates a tar file with the following structure:
manifest
control
/./
- empty entry directory
... because the current dir component gets stripped away here:
Line 1502 in 60c6bd8
Just changing this line to:
(Component::CurDir, false) => {},
fixes the problem.
I have the following questions:
- Is there a way to create the desired tar file with the current API provided by
tar-rs
? - If no, would a contribution be accepted for making it work and if so, what would the requirements for that be/how should that look like?
Thanks!
Metadata
Metadata
Assignees
Labels
No labels