From a3773b6922543075750a5b4ed47e79f34e60d800 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Tue, 15 Jul 2025 06:12:37 -0400 Subject: [WARP] Misc improvements - Fix project file filter not blacklisting warp files - Fix project name not being used for default file save name - Prevent adding the same file to the available sources --- plugins/warp/src/plugin/create.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'plugins/warp/src/plugin/create.rs') diff --git a/plugins/warp/src/plugin/create.rs b/plugins/warp/src/plugin/create.rs index 9ebcba2d..0410e74a 100644 --- a/plugins/warp/src/plugin/create.rs +++ b/plugins/warp/src/plugin/create.rs @@ -19,13 +19,18 @@ pub struct SaveFileField; impl SaveFileField { pub fn field(view: &BinaryView) -> FormInputField { - let default_name = view - .file() - .filename() - .split('/') - .last() - .unwrap_or("file") - .to_string(); + let file = view.file(); + let default_name = match file.project_file() { + None => { + // Not in a project, use the file name directly. + file.filename() + .split('/') + .last() + .unwrap_or("file") + .to_string() + } + Some(project_file) => project_file.name(), + }; let signature_dir = user_signature_dir(); let default_file_path = signature_dir.join(&default_name).with_extension("warp"); FormInputField::SaveFileName { @@ -177,6 +182,7 @@ impl CreateFromCurrentView { if std::fs::write(&file_path, file.to_bytes()).is_err() { log::error!("Failed to write data to signature file!"); } + log::info!("Saved signature file to: '{}'", file_path.display()); // Show a report of the generate signatures, if desired. let report_generator = ReportGenerator::new(); -- cgit v1.3.1