how reading a file? #7323
-
I'm trying to read a file, almost every thing is right except for a folder called Why in the world the Tauri is tryin to access a tauri config: "fs": {
"scope": [
"$RESOURCE/**"
]
} code in Typescript: const home = await readTextFile("/data/file.txt", { dir: BaseDirectory.Resource }); Could anyone say why it is happening?? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Because tauri reconstructs the paths of the bundled resources. so if you bundle for example |
Beta Was this translation helpful? Give feedback.
okay, so i think i misunderstood the problem then. i though the data dir is actually at the root of your filesystem. In this case you probably only need to remove the leading
/
in resolveResource to make it work.In general, resolveResource expects path similar to how you specified them in the resources property in tauri.conf.json, a few examples: