Issue
I am familiarizing myself with the tauri framework currently by developing a small desktop app. Most of the tauri JS API modules I have been testing have worked so far, except for the dialog
and notification
modules. When any of the functions from the dialog
module are tested, for example open
, the promise immediately resolves with a null
value, and nothing on the tauri end noticeably occurs (for example, when the open
function is called, a file dialog should appear). I haven't altered the generated Rust files at all, and I am using a VueJS SPA on the frontend, which I have been running in a 64-bit Windows 10 environment. Additionally, the tauri.conf.json
file has the correct permissions set for the use of these modules.
This is the code where I call the dialog.open
function:
import { Options, Vue } from "vue-class-component";
import { open as openDialog } from "@tauri-apps/api/dialog";
@Options({
components: {
... some vue components ...
},
})
export default class Freeze extends Vue {
selectedFilepaths: string[] = [];
async selectFile(){
const pathName: string = await openDialog({
defaultPath: ".",
multiple: false
}) as string;
this.selectedFilepaths.push(pathName);
}
}
Any help would be much appreciated :)
Solution
Turns out, the culprit was defaultPath
field.
You have to provide a valid path there (or not use it at all), otherwise it will fail silently.
Answered By - Ilia Andrienko
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.