The Tauri project file ./src-tauri/tauri.conf.json has the JSON value tauri.bundle.identifier: "com.tauri.dev".
How do I access it from within my app?
My Usecase
I need to write to ${dataDir}/${bundleIdentifier}/my-file.txt. Like so:
const fs = window.__TAURI__.fs;
const path = window.__TAURI__.path;
const id = "com.tauri.dev";
let filename = "my-file.txt";
let _path = await path.join(id, filename);
let data = "Hello World!";
await fs.writeFile({
path: _path,
contents: data
}, { dir: fs.Dir.Data });
Except I want to get the com.tauri.dev value from from ./src-tauri/tauri.conf.json rather than being manually inserted.
What's the proper way to do that?
Well, the simples Rust way to do it would be to just include it in your binary like so:
(not tested code)
The proper Tauri way is to get App's handle and access config directly.
One more version: