use std::path::Path;
pub fn file_browse_tosave(sggstdpath: &str, sggstdname: &str, sggstdextnsn: &str, wintitle: &str) -> String {
let track = dir_check_valid(&mut sggstdpath.to_string()); let startpath = Path::new(track.as_str());
let mut fchooser = dialog::NativeFileChooser
::new(dialog::NativeFileChooserType
::BrowseSaveFile);
fchooser.set_directory(&startpath).expect("Cannot set directory.");
let ext_to_append = sggstdextnsn.strip_prefix("*.").unwrap_or(sggstdextnsn);
let usename = format!("{}.{}", sggstdname, ext_to_append);
fchooser.set_preset_file(usename.as_str());
let useext;
if !sggstdextnsn.starts_with("*.") {
useext = format!("*.{}", sggstdextnsn);
} else {
useext = sggstdextnsn.to_string();
}
let combined_filter = format!("List Files\t{}\nAll Files\t*.*", useext);
fchooser.set_filter(&combined_filter);
fchooser.set_title(wintitle);
fchooser.show();
let path = fchooser.filename().to_str().unwrap().to_string();
path
}