diff --git a/Cargo.lock b/Cargo.lock index 21f4488..49b328a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,7 +26,6 @@ dependencies = [ "dh", "neozip", "rici", - "uu_mkdir", ] [[package]] @@ -44,67 +43,12 @@ dependencies = [ "libc", ] -[[package]] -name = "anstream" -version = "0.6.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" - -[[package]] -name = "anstyle-parse" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" -dependencies = [ - "anstyle", - "windows-sys 0.59.0", -] - [[package]] name = "autocfg" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" -[[package]] -name = "bitflags" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - [[package]] name = "block-buffer" version = "0.10.4" @@ -135,12 +79,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - [[package]] name = "chrono" version = "0.4.38" @@ -155,40 +93,6 @@ dependencies = [ "windows-targets", ] -[[package]] -name = "clap" -version = "4.5.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" -dependencies = [ - "clap_builder", -] - -[[package]] -name = "clap_builder" -version = "4.5.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", - "terminal_size", -] - -[[package]] -name = "clap_lex" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" - -[[package]] -name = "colorchoice" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" - [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -239,22 +143,6 @@ dependencies = [ "crypto-common", ] -[[package]] -name = "dunce" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" - -[[package]] -name = "errno" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "generic-array" version = "0.14.7" @@ -265,12 +153,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - [[package]] name = "iana-time-zone" version = "0.1.61" @@ -294,12 +176,6 @@ dependencies = [ "cc", ] -[[package]] -name = "is_terminal_polyfill" -version = "1.70.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" - [[package]] name = "js-sys" version = "0.3.70" @@ -321,12 +197,6 @@ version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" -[[package]] -name = "linux-raw-sys" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" - [[package]] name = "log" version = "0.4.22" @@ -349,18 +219,6 @@ dependencies = [ "dh", ] -[[package]] -name = "nix" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" -dependencies = [ - "bitflags", - "cfg-if", - "cfg_aliases", - "libc", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -370,27 +228,12 @@ dependencies = [ "autocfg", ] -[[package]] -name = "number_prefix" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" - [[package]] name = "once_cell" version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" -[[package]] -name = "os_display" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6229bad892b46b0dcfaaeb18ad0d2e56400f5aaea05b768bde96e73676cf75" -dependencies = [ - "unicode-width", -] - [[package]] name = "proc-macro2" version = "1.0.87" @@ -412,20 +255,8 @@ dependencies = [ [[package]] name = "rici" version = "0.1.0" -source = "git+https://github.com/Le0X8/rici.git?branch=main#aa1bb0396c01ecca73c8af7dcf21dc672de988be" - -[[package]] -name = "rustix" -version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] +checksum = "5a7fc6b58eab401e28a89b8f8a7e8bace8e2bc1aae46a309d64d9d96946a6257" [[package]] name = "sha2" @@ -444,12 +275,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - [[package]] name = "syn" version = "2.0.79" @@ -461,16 +286,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "terminal_size" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f599bd7ca042cfdf8f4512b277c02ba102247820f9d9d4a9f521f496751a6ef" -dependencies = [ - "rustix", - "windows-sys 0.59.0", -] - [[package]] name = "typenum" version = "1.17.0" @@ -483,66 +298,6 @@ version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - -[[package]] -name = "uu_mkdir" -version = "0.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feba7cf875eecbb746b1c5a5a8a031ab3a00e5f44f5441643a06b78577780d3a" -dependencies = [ - "clap", - "uucore", -] - -[[package]] -name = "uucore" -version = "0.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04ea43050c46912575654c5181f4135529e8d4003fca80803af10cdef3ca6412" -dependencies = [ - "clap", - "dunce", - "glob", - "libc", - "nix", - "number_prefix", - "once_cell", - "os_display", - "uucore_procs", - "wild", - "winapi-util", - "windows-sys 0.59.0", - "xattr", -] - -[[package]] -name = "uucore_procs" -version = "0.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91d598cf92275d9373e1eb0b9dcf85b730bde48186ed7db3bde713803090511" -dependencies = [ - "proc-macro2", - "quote", - "uuhelp_parser", -] - -[[package]] -name = "uuhelp_parser" -version = "0.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b4d8c991cc252d4b4ea2958d0d842e36af0d1ca7f1fdc4fdce8fd0a2ff6e9c" - [[package]] name = "version_check" version = "0.9.5" @@ -604,24 +359,6 @@ version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" -[[package]] -name = "wild" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3131afc8c575281e1e80f36ed6a092aa502c08b18ed7524e86fbbb12bb410e1" -dependencies = [ - "glob", -] - -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys 0.59.0", -] - [[package]] name = "windows-core" version = "0.52.0" @@ -631,24 +368,6 @@ dependencies = [ "windows-targets", ] -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets", -] - [[package]] name = "windows-targets" version = "0.52.6" @@ -712,14 +431,3 @@ name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "xattr" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" -dependencies = [ - "libc", - "linux-raw-sys", - "rustix", -] diff --git a/Cargo.toml b/Cargo.toml index c5785a5..bd9b1c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,6 @@ chrono = "0.4.38" crc32fast = "1.4.2" dh = "0.8.0" neozip = "0.3.1" -uu_mkdir = "0.0.28" [dev-dependencies] -rici = { git = "https://github.com/Le0X8/rici.git", branch = "main" } \ No newline at end of file +rici = "0.1.0" \ No newline at end of file diff --git a/src/archive/extract.rs b/src/archive/extract.rs index ba9c4a7..9677487 100644 --- a/src/archive/extract.rs +++ b/src/archive/extract.rs @@ -5,16 +5,16 @@ use dh::recommended::*; use neozip; pub fn extract_all(input: &Path, output: &Path, format: Format, buffer_size: u64) -> Result<()> { - let mut reader = dh::file::open_r(input)?; + let mut reader = dh::file::open_r(input).unwrap(); - prepare_output_dir(output)?; + prepare_output_dir(output).unwrap(); match format { Format::Zip => { - let meta = neozip::metadata(&mut reader)?; + let meta = neozip::metadata(&mut reader).unwrap(); for file in meta.files { - let mut writer = dh::file::open_w(output.join(&file.path))?; - neozip::extract_content(&mut reader, &mut writer, &file, buffer_size)?; + let mut writer = dh::file::open_w(output.join(&file.path)).unwrap(); + neozip::extract_content(&mut reader, &mut writer, &file, buffer_size).unwrap(); } } }; diff --git a/src/lib.rs b/src/lib.rs index 1f65096..b5f04b3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,6 +5,7 @@ pub mod file; pub mod formats; use std::{ + fs::create_dir_all, io::{Error, ErrorKind, Result}, path::Path, }; @@ -15,7 +16,7 @@ pub fn get_version() -> &'static str { pub(crate) fn prepare_output_dir(output: &Path) -> Result<()> { if !output.exists() { - match uu_mkdir::mkdir(output, true, 0o644, false) { + match create_dir_all(output) { Ok(_) => {} Err(_) => { return Err(Error::new(