replace path entities from filename

This commit is contained in:
yggverse 2024-12-12 08:48:31 +02:00
parent 6e7a1d51e5
commit 80684e0316

View File

@ -9,7 +9,7 @@ use gtk::{
prelude::{ButtonExt, FileExt, OutputStreamExtManual, WidgetExt}, prelude::{ButtonExt, FileExt, OutputStreamExtManual, WidgetExt},
Button, FileDialog, FileFilter, Window, Button, FileDialog, FileFilter, Window,
}; };
use std::rc::Rc; use std::{path::MAIN_SEPARATOR, rc::Rc};
const LABEL: &str = "Export"; const LABEL: &str = "Export";
const TOOLTIP_TEXT: &str = "Export selected identity to file"; const TOOLTIP_TEXT: &str = "Export selected identity to file";
@ -62,7 +62,10 @@ impl Save {
FileDialog::builder() FileDialog::builder()
.default_filter(&filter_pem) .default_filter(&filter_pem)
.filters(&filters) .filters(&filters)
.initial_name(format!("{}.pem", certificate.name)) .initial_name(format!(
"{}.pem",
certificate.name.replace(MAIN_SEPARATOR, "-")
))
.build() .build()
.save(Window::NONE, Cancellable::NONE, { .save(Window::NONE, Cancellable::NONE, {
let button = button.clone(); let button = button.clone();