Skip to content

Commit 4926648

Browse files
deps: Libflate to flate2 (#8618)
* Replace libflate with flate2 * Add .changes file * Cargo fmt
1 parent 06890c7 commit 4926648

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

.changes/libflate-to-flate2.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-bundler": patch:deps
3+
---
4+
5+
Replace `libflate` with `flate2` , this will help to provide additional functionalities and features.

tooling/bundler/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ exclude = [ "CHANGELOG.md", "/target", "rustfmt.toml" ]
1919
[dependencies]
2020
tauri-utils = { version = "1.5.2", path = "../../core/tauri-utils", features = [ "resources" ] }
2121
image = "0.24.7"
22-
libflate = "2.0"
22+
flate2 = "1.0"
2323
anyhow = "1.0"
2424
thiserror = "1.0"
2525
serde_json = "1.0"

tooling/bundler/src/bundle/linux/debian.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ use anyhow::Context;
2929
use handlebars::Handlebars;
3030
use heck::AsKebabCase;
3131
use image::{self, codecs::png::PngDecoder, ImageDecoder};
32-
use libflate::gzip;
3332
use log::info;
3433
use serde::Serialize;
3534
use tar::HeaderMode;
@@ -44,6 +43,8 @@ use std::{
4443
path::{Path, PathBuf},
4544
};
4645

46+
use flate2::{write::GzEncoder, Compression};
47+
4748
#[derive(PartialEq, Eq, PartialOrd, Ord)]
4849
pub struct DebIcon {
4950
pub width: u32,
@@ -391,9 +392,9 @@ fn tar_and_gzip_dir<P: AsRef<Path>>(src_dir: P) -> crate::Result<PathBuf> {
391392
let src_dir = src_dir.as_ref();
392393
let dest_path = src_dir.with_extension("tar.gz");
393394
let dest_file = common::create_file(&dest_path)?;
394-
let gzip_encoder = gzip::Encoder::new(dest_file)?;
395+
let gzip_encoder = GzEncoder::new(dest_file, Compression::default());
395396
let gzip_encoder = create_tar_from_dir(src_dir, gzip_encoder)?;
396-
let mut dest_file = gzip_encoder.finish().into_result()?;
397+
let mut dest_file = gzip_encoder.finish()?;
397398
dest_file.flush()?;
398399
Ok(dest_path)
399400
}

tooling/bundler/src/bundle/updater_bundle.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ use std::{
2323
path::{Path, PathBuf},
2424
};
2525

26+
use flate2::{write::GzEncoder, Compression};
27+
2628
use anyhow::Context;
2729
use log::info;
2830
use zip::write::FileOptions;
@@ -235,11 +237,11 @@ pub fn create_zip(src_file: &Path, dst_file: &Path) -> crate::Result<PathBuf> {
235237
#[cfg(not(target_os = "windows"))]
236238
fn create_tar(src_dir: &Path, dest_path: &Path) -> crate::Result<PathBuf> {
237239
let dest_file = common::create_file(dest_path)?;
238-
let gzip_encoder = libflate::gzip::Encoder::new(dest_file)?;
240+
let gzip_encoder = GzEncoder::new(dest_file, Compression::default());
239241

240242
let gzip_encoder = create_tar_from_src(src_dir, gzip_encoder)?;
241243

242-
let mut dest_file = gzip_encoder.finish().into_result()?;
244+
let mut dest_file = gzip_encoder.finish()?;
243245
dest_file.flush()?;
244246
Ok(dest_path.to_owned())
245247
}

0 commit comments

Comments
 (0)