From 793f28d7feeda8a51e83dd3aa41f84346a6539e9 Mon Sep 17 00:00:00 2001 From: DastInDark <2350416+hitenkoku@users.noreply.github.com> Date: Tue, 27 Sep 2022 21:41:17 +0900 Subject: [PATCH] changed html report file output check before scanning --- src/main.rs | 12 ++++++++++++ src/options/htmlreport.rs | 9 --------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main.rs b/src/main.rs index 432f1f28..d20fc8fe 100644 --- a/src/main.rs +++ b/src/main.rs @@ -262,6 +262,18 @@ impl App { println!(); } + if let Some(path) = &configs::CONFIG.read().unwrap().args.html_report { + // if already exists same html report file. output alert message and exit + if path.exists() { + AlertMessage::alert(&format!( + " The file {} already exists. Please specify a different filename.", + path.to_str().unwrap() + )) + .ok(); + return; + } + } + write_color_buffer( &BufferWriter::stdout(ColorChoice::Always), None, diff --git a/src/options/htmlreport.rs b/src/options/htmlreport.rs index c1386288..46ea5437 100644 --- a/src/options/htmlreport.rs +++ b/src/options/htmlreport.rs @@ -95,15 +95,6 @@ pub fn create_html_file(input_html: String, path_str: String) { create_dir(path.parent().unwrap()).ok(); } - // if already exists same html report file. output alert message and exit - if path.exists() { - AlertMessage::alert(&format!( - " The file {} already exists. Please specify a different filename.", - &path_str - )) - .ok(); - return; - } let mut html_writer = BufWriter::new(File::create(path).unwrap()); let html_data = format!( "{}",