summaryrefslogtreecommitdiff
path: root/plugins/warp/src/plugin/create.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-07-15 06:12:37 -0400
committerMason Reed <mason@vector35.com>2025-07-15 12:34:43 -0400
commita3773b6922543075750a5b4ed47e79f34e60d800 (patch)
tree542d88518fd3b381e1ddf06c0c4be959678ffa20 /plugins/warp/src/plugin/create.rs
parentd6c098813fde016e225c4ee072f38cd69d9783f0 (diff)
[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
Diffstat (limited to 'plugins/warp/src/plugin/create.rs')
-rw-r--r--plugins/warp/src/plugin/create.rs20
1 files changed, 13 insertions, 7 deletions
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();