diff --git a/src/commands.rs b/src/commands.rs index 1559ec9..235792c 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -342,6 +342,10 @@ fn decompress_file( // // Any other Zip decompression done can take up the whole RAM and freeze ouch. if formats.len() == 1 && *formats[0].compression_formats == [Zip] { + if utils::clear_path(output_dir, question_policy)?.is_none() { + // User doesn't want to overwrite + return Ok(()); + } utils::create_dir_if_non_existent(output_dir)?; let zip_archive = zip::ZipArchive::new(reader)?; let _files = crate::archive::zip::unpack_archive(zip_archive, output_dir, question_policy)?; @@ -370,6 +374,10 @@ fn decompress_file( reader = chain_reader_decoder(format, reader)?; } + if utils::clear_path(&output_path, question_policy)?.is_none() { + // User doesn't want to overwrite + return Ok(()); + } utils::create_dir_if_non_existent(output_dir)?; let files_unpacked;