This commit is contained in:
2026-05-09 18:14:57 -05:00
parent d6b816d273
commit 619ac5f9d1
+7 -2
View File
@@ -1,5 +1,7 @@
use std::ffi::OsString;
use std::path::{Path, PathBuf};
use flate2::Compression;
use flate2::write::GzEncoder;
use clap::{Parser, Subcommand};
use crate::error::DrawerError;
use crate::parsing::KeyType::*;
@@ -108,10 +110,13 @@ impl DrawerOperation {
fn perform_close(&self) -> Result<(), DrawerError> {
let mut buf: Vec<u8> = Vec::new();
{
let mut archive = tar::Builder::new(&mut buf);
let gz = GzEncoder::new(&mut buf, Compression::default());
let mut archive = tar::Builder::new(gz);
archive.append_dir_all(".", &self.target_path)
.map_err(|_| DrawerError::TarFailed)?;
archive.finish()
let gz = archive.into_inner()
.map_err(|_| DrawerError::TarFailed)?;
gz.finish()
.map_err(|_| DrawerError::TarFailed)?;
}
std::fs::write(&self.drawer_file, &buf)