I'm using Tauri v2, and I'm trying to list all the markdown documents in ~/Documents. I just can't get the permissions to work. No matter what I try, I get these errors:
Error: failed to read directory at path: /Users/krisjenkins/Documents with error: No such file or directory (os error 2)
Error: forbidden path: /Users/krisjenkins/Documents/The_King_Is_Dead.md
(Yes, that directory and file both exist. ๐)
Here's the current contents of src-tauri/capabilities/default.json:
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "enables the default permissions",
"windows": [
"main"
],
"permissions": [
"core:default",
"fs:allow-document-read",
{
"identifier": "fs:allow-read-dir",
"allow": [
{
"path": "$DOCUMENT"
}
]
},
{
"identifier": "fs:allow-read-text-file",
"allow": [
{
"path": "$DOCUMENT/*.md"
}
]
}
]
}
And here's the relevant JavaScript I'm calling:
const documentDirPath = await documentDir();
const entries = await readDir(documentDirPath);
const markdowns = entries.filter((entry) => entry.name.endsWith(".md"));
return markdowns;
I've tried many variations on this, but whatever I do I'm stuck on the same error messages. ๐ญ
Can anyone help, please? ๐