I set up a new tauri/svelte project, and I need to be able to read and write files in a specific directory, preferably contained within the project. Where should I put that directory in my project? Anytime I try to access files I get a disallowed error. Could anyone please let me know which permissions I need to enable to allow users to access that one directory, read, write, create, and delete files in that dir, thanks
#Read/Write files in app src
12 messages · Page 1 of 1 (latest)
this is explicitly not supported by the permission system (except for the allow all scope **/* ) and the fs/path apis because it would only work in tauri dev while in prod you'd be hitting OS permissions errors (read-only locations).
So it's not possible at all to manage files in an app src directory outside of the dev env? Sorry if I'm not understanding you correctly, I'm new to tauri and the docs have been a bit confusing on this subject
i mean, what's the "app src dir" after you build / install the app?
this also isn't reallyyy tauri specific
I’d like to have a directory in the project root called data or something which contains json files. There would be features to create a new json file there and read/write to one of the files
The only think I don’t know how to do is allow access to that directory
And yes, after build/install
which OS do you need this to work on?
because that can only work on windows with perUser installations. with perMachine (tauri's msi installer or nsis in perMachine mode) on windows, or all installation options on linux and macos this is not possible.
(with the exception of appimages on linux but that requires some special handling)
if you only care about windows in perUser mode then you can use the $RESOURCE var and resourceDir() function as that will be next to the exe on windows.