mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-06 11:35:45 +00:00
feat: RefCell remove
This commit is contained in:
parent
f2b984bc7a
commit
2ebdaf6ecf
@ -34,7 +34,7 @@ unrar = "0.5.2"
|
||||
xz2 = "0.1.7"
|
||||
zip = { version = "0.6.6", default-features = false, features = ["time"] }
|
||||
zstd = { version = "0.13.0", default-features = false }
|
||||
sevenz-rust = {version = "0.2.9", features = ["compress"]}
|
||||
sevenz-rust = {version = "0.2.10", features = ["compress"]}
|
||||
|
||||
[target.'cfg(not(unix))'.dependencies]
|
||||
is_executable = "1.0.1"
|
||||
|
@ -1,5 +1,4 @@
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
io::{self, BufReader, Read},
|
||||
path::Path,
|
||||
};
|
||||
@ -89,17 +88,17 @@ pub fn list_archive_contents(
|
||||
}
|
||||
},
|
||||
SevenZip => {
|
||||
let a = RefCell::new(Vec::new());
|
||||
let mut a = Vec::new();
|
||||
|
||||
sevenz_rust::decompress_file_with_extract_fn(archive_path, ".", |entry, _, _| {
|
||||
a.borrow_mut().push(Ok(FileInArchive {
|
||||
a.push(Ok(FileInArchive {
|
||||
path: entry.name().into(),
|
||||
is_dir: entry.is_directory(),
|
||||
}));
|
||||
Ok(true)
|
||||
})
|
||||
.map_err(|e| crate::Error::SevenzipError(e))?;
|
||||
Box::new(a.into_inner().into_iter())
|
||||
Box::new(a.into_iter())
|
||||
}
|
||||
Gzip | Bzip | Lz4 | Lzma | Snappy | Zstd => {
|
||||
panic!("Not an archive! This should never happen, if it does, something is wrong with `CompressionFormat::is_archive()`. Please report this error!");
|
||||
|
Loading…
x
Reference in New Issue
Block a user