Hello,
I'm a beginner with Tauri. I'm using Tauri 2.0 to develop an application that manipulates and stores images imported by the user. These images are imported into a folder, let's say USER_DIR. I want to authorize my application (frontend javascript) to access the USER_DIR folder.
I got interested in File System plugin : https://v2.tauri.app/plugin/file-system/ and I'm having a hard time getting it to work...
I run
$ cargo tauri add fs
Info Installing Cargo dependency "tauri-plugin-fs"...
Updating crates.io index
Adding tauri-plugin-fs v2.0.0-beta.10 to dependencies
Features:
- notify
- notify-debouncer-full
- watch
Added permission `fs:default` to `default` at /home/xxxx/src-tauri/capabilities/default.json
Info Plugin initialization code already found on /home/xxxx/src-tauri/src/main.rs
then add in my default.json file
"fs:default",
{
"identifier": "fs:allow-exists",
"allow": [
{
"path": "$APPDATA/*"
}
]
}
Then in tauri.conf.json file I add
"plugins": {
"fs": {
"all": true,
"scope": [
"$APPDATA/*",
"$APPDATA"
]
}
}
Then within my frontend I used the example provided here https://v2.tauri.app/plugin/file-system/
import { exists, BaseDirectory } from '@tauri-apps/plugin-fs';
await exists('avatar.png', { baseDir: BaseDirectory.AppData });
and I get the following error in my frontend console:
TypeError: Module name, '@tauri-apps/plugin-fs' does not resolve to a valid URL.
Do you know what I might have missed here?
Thanks,