#Read/Write files in app src

12 messages · Page 1 of 1 (latest)

waxen fable
#

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

novel frigate
#

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).

waxen fable
novel frigate
#

i mean, what's the "app src dir" after you build / install the app?

#

this also isn't reallyyy tauri specific

waxen fable
#

The only think I don’t know how to do is allow access to that directory

#

And yes, after build/install

novel frigate
#

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.