phase 3a
This commit is contained in:
+7
-2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user