idk i just merged and patch some

Signed-off-by: MisileLab <misileminecord@gmail.com>
This commit is contained in:
MisileLab 2023-08-20 02:32:59 +09:00 committed by João Marcos
parent 8023a9157e
commit 9a6d73bf57
3 changed files with 10 additions and 14 deletions

8
Cargo.lock generated
View File

@ -776,9 +776,9 @@ dependencies = [
[[package]] [[package]]
name = "nt-time" name = "nt-time"
version = "0.4.1" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91dd7a30dbf611fc3c790404c9ef8e1631971a9dd020a45905c7685727e9cf43" checksum = "b1d4f129ec1833164165b1711c30b4fa4a2b12784ffefa9fe877b016704b7165"
dependencies = [ dependencies = [
"chrono", "chrono",
"time", "time",
@ -1172,9 +1172,9 @@ dependencies = [
[[package]] [[package]]
name = "sevenz-rust" name = "sevenz-rust"
version = "0.2.11" version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bf83efe73d438a1aad929279a2fc0ff3fb32f841421c09a64f3d04c4d162a23" checksum = "33c7d45965e6557597a30e2d12e15d6a5f438bb7cbc11d5dbe89762541c0cd42"
dependencies = [ dependencies = [
"bit-set", "bit-set",
"byteorder", "byteorder",

View File

@ -26,7 +26,7 @@ lz4_flex = "0.11.1"
once_cell = "1.18.0" once_cell = "1.18.0"
rayon = "1.8.0" rayon = "1.8.0"
same-file = "1.0.6" same-file = "1.0.6"
sevenz-rust = {version = "0.2.10", features = ["compress"]} sevenz-rust = {version = "0.5.3", features = ["compress"]}
snap = "1.1.0" snap = "1.1.0"
tar = "0.4.40" tar = "0.4.40"
tempfile = "3.8.1" tempfile = "3.8.1"
@ -35,7 +35,6 @@ unrar = "0.5.2"
xz2 = "0.1.7" xz2 = "0.1.7"
zip = { version = "0.6.6", default-features = false, features = ["time"] } zip = { version = "0.6.6", default-features = false, features = ["time"] }
zstd = { version = "0.13.0", default-features = false } zstd = { version = "0.13.0", default-features = false }
sevenz-rust = {version = "0.2.10", features = ["compress"]}
[target.'cfg(not(unix))'.dependencies] [target.'cfg(not(unix))'.dependencies]
is_executable = "1.0.1" is_executable = "1.0.1"

View File

@ -1,8 +1,7 @@
//! SevenZip archive format compress function //! SevenZip archive format compress function
use std::{ use std::path::{Path, PathBuf};
env::current_dir,
path::{Path, PathBuf}, use crate::utils::strip_cur_dir;
};
pub fn compress_sevenz(files: Vec<PathBuf>, output_path: &Path) -> crate::Result<bool> { pub fn compress_sevenz(files: Vec<PathBuf>, output_path: &Path) -> crate::Result<bool> {
let mut writer = sevenz_rust::SevenZWriter::create(output_path).map_err(crate::Error::SevenzipError)?; let mut writer = sevenz_rust::SevenZWriter::create(output_path).map_err(crate::Error::SevenzipError)?;
@ -10,11 +9,9 @@ pub fn compress_sevenz(files: Vec<PathBuf>, output_path: &Path) -> crate::Result
for filep in files.iter() { for filep in files.iter() {
writer writer
.push_archive_entry::<std::fs::File>( .push_archive_entry::<std::fs::File>(
sevenz_rust::SevenZWriter::<std::fs::File>::create_archive_entry( sevenz_rust::SevenZArchiveEntry::from_path(
filep, filep,
filep strip_cur_dir(filep)
.strip_prefix(current_dir()?)
.expect("StripPrefix Failed")
.as_os_str() .as_os_str()
.to_str() .to_str()
.unwrap() .unwrap()