From 1d3554a18d94ed7ea39c0c778921c6140a8781c6 Mon Sep 17 00:00:00 2001 From: figsoda Date: Thu, 14 Oct 2021 18:07:37 -0400 Subject: [PATCH] Fix single file decompression with specified output directory --- src/commands.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/commands.rs b/src/commands.rs index 05db7a6..c8289fa 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -305,6 +305,8 @@ fn decompress_file( reader = chain_reader_decoder(format, reader)?; } + utils::create_dir_if_non_existent(output_folder)?; + match formats[0] { Gzip | Bzip | Lzma | Zstd => { reader = chain_reader_decoder(&formats[0], reader)?; @@ -316,19 +318,15 @@ fn decompress_file( info!("Successfully uncompressed archive in '{}'.", to_utf(output_path)); } Tar => { - utils::create_dir_if_non_existent(output_folder)?; let _ = crate::archive::tar::unpack_archive(reader, output_folder, flags)?; info!("Successfully uncompressed archive in '{}'.", to_utf(output_folder)); } Tgz => { - utils::create_dir_if_non_existent(output_folder)?; let reader = chain_reader_decoder(&Gzip, reader)?; let _ = crate::archive::tar::unpack_archive(reader, output_folder, flags)?; info!("Successfully uncompressed archive in '{}'.", to_utf(output_folder)); } Zip => { - utils::create_dir_if_non_existent(output_folder)?; - eprintln!("Compressing first into .zip."); eprintln!("Warning: .zip archives with extra extensions have a downside."); eprintln!(