See what file filter the user had selected in diolog.open #10162
-
In my Tauri application I have a button where users can open a file that can be of a couple of different formats. Right now it just tries all formats and sees which it recognises but I would like to allow a user to specify a specific format by using the dialog build in filter as seen in windows (see screenshot below). If I would be able to see which filter the user had applied I can use that to specifically open the file in that format. Which in my case would result in a more helpful error message if the file is broken in some way. Is it possible to get this information somehow? I can imagine that this might not even be present in the information Tauri gets, if so I will have to think of a different way of doing this. let properties = {
directory: false,
filters: [{
extensions: ["csv", "csv.gz", "tsv", "tsv.gz", "psmtsv", "psmtsv.gz", "fasta", "fasta.gz", "txt", "txt.gz"], name: "*"
},
{
extensions: ["csv", "csv.gz"], name: "Peaks"
},
{
extensions: ["csv", "csv.gz"], name: "Novor"
}]
};
window.__TAURI__.dialog.open(properties).then((result) => {
if (result != null) {
// Logic, result is a single string with the selected path.
}
}) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is currently not possible in Tauri or the rust crate we use to display files. On an OS api level at least windows does support it but i'm not sure how one could integrate that into the dialog crates api (https://docs.rs/rfd/latest/rfd/) 🤔 |
Beta Was this translation helpful? Give feedback.
This is currently not possible in Tauri or the rust crate we use to display files.
On an OS api level at least windows does support it but i'm not sure how one could integrate that into the dialog crates api (https://docs.rs/rfd/latest/rfd/) 🤔