deps: Libflate to flate2 (#8618)

* Replace libflate with flate2

* Add .changes file

* Cargo fmt
This commit is contained in:
Naman Garg 2024-01-16 19:22:19 +05:30 committed by GitHub
parent 06890c70c6
commit 4926648751
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 6 deletions

View File

@ -0,0 +1,5 @@
---
"tauri-bundler": patch:deps
---
Replace `libflate` with `flate2` , this will help to provide additional functionalities and features.

View File

@ -19,7 +19,7 @@ exclude = [ "CHANGELOG.md", "/target", "rustfmt.toml" ]
[dependencies]
tauri-utils = { version = "1.5.2", path = "../../core/tauri-utils", features = [ "resources" ] }
image = "0.24.7"
libflate = "2.0"
flate2 = "1.0"
anyhow = "1.0"
thiserror = "1.0"
serde_json = "1.0"

View File

@ -29,7 +29,6 @@ use anyhow::Context;
use handlebars::Handlebars;
use heck::AsKebabCase;
use image::{self, codecs::png::PngDecoder, ImageDecoder};
use libflate::gzip;
use log::info;
use serde::Serialize;
use tar::HeaderMode;
@ -44,6 +43,8 @@ use std::{
path::{Path, PathBuf},
};
use flate2::{write::GzEncoder, Compression};
#[derive(PartialEq, Eq, PartialOrd, Ord)]
pub struct DebIcon {
pub width: u32,
@ -391,9 +392,9 @@ fn tar_and_gzip_dir<P: AsRef<Path>>(src_dir: P) -> crate::Result<PathBuf> {
let src_dir = src_dir.as_ref();
let dest_path = src_dir.with_extension("tar.gz");
let dest_file = common::create_file(&dest_path)?;
let gzip_encoder = gzip::Encoder::new(dest_file)?;
let gzip_encoder = GzEncoder::new(dest_file, Compression::default());
let gzip_encoder = create_tar_from_dir(src_dir, gzip_encoder)?;
let mut dest_file = gzip_encoder.finish().into_result()?;
let mut dest_file = gzip_encoder.finish()?;
dest_file.flush()?;
Ok(dest_path)
}

View File

@ -23,6 +23,8 @@ use std::{
path::{Path, PathBuf},
};
use flate2::{write::GzEncoder, Compression};
use anyhow::Context;
use log::info;
use zip::write::FileOptions;
@ -235,11 +237,11 @@ pub fn create_zip(src_file: &Path, dst_file: &Path) -> crate::Result<PathBuf> {
#[cfg(not(target_os = "windows"))]
fn create_tar(src_dir: &Path, dest_path: &Path) -> crate::Result<PathBuf> {
let dest_file = common::create_file(dest_path)?;
let gzip_encoder = libflate::gzip::Encoder::new(dest_file)?;
let gzip_encoder = GzEncoder::new(dest_file, Compression::default());
let gzip_encoder = create_tar_from_src(src_dir, gzip_encoder)?;
let mut dest_file = gzip_encoder.finish().into_result()?;
let mut dest_file = gzip_encoder.finish()?;
dest_file.flush()?;
Ok(dest_path.to_owned())
}