Hi there, i have a question:
I want to put some html templates in the src/templates folder and load them dynamicly.
I have them listed in the tauri.conf.json
"resources": [
"../src/templates/*",
and i have a fs-read-capabilities.tml
identifier = "fs-read-templates"
description = "Erlaubt das Lesen von HTML-Templates"
windows = ["main"]
permissions = [
"fs:allow-exists",
"fs:allow-read-text-file",
"fs:allow-resource-read-recursive",
]
[scope.fs.allow]
path = ["$RESOURCE/../../src/templates/*"]
i tried it so many times with all kinds of paths, even having it under src_tauri/resources/templates
but i always get the forbidden path warning.
my call looks like this:
const templatePath = "templates";
const resourcePath = `${templatePath}/${name}`;
const fileExists = await exists(resourcePath);
if (!fileExists) {
console.warn("⚠️ Datei existiert nicht:", resourcePath);
} else {
console.warn("⚠️ Datei existiert:", resourcePath);
}
const template = await readTextFile(templatePath + name, {
//baseDir: BaseDirectory.AppData,
baseDir: BaseDirectory.Resource,
// baseDir: (await isDev)
// ? BaseDirectory.AppData
// : BaseDirectory.Resource,
});
How can i get this working?
Where do i get it wrong?
Where should i best put my Templates?