How to get the current Project directory path #7308
-
|
I'm currently working on an app that deals with file systems a lot. I wanted to set up an exemplary one in my project folder for my own convenience. It is found on the same level as the Now I wanted to ask if there is an intelligent way to get said project directory path. The best thing I found was to use the RESOURCE dir and work my way up from there. There is one discussion #7199 that mentions this. There the solution was to use Rusts cwd. From my testing (printing it in the console) this leads to Also on a related note. Is it better to do file searching (like filter out all images in a directory) in Rust or js/ts? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yeah, so using rust is really the closest you'll get to it since that's the actual cwd of the program. While tauri's cli is typically aware of the project's root the tauri crate is not, Can't think of an automatic way to get the dir you're expecting rn 🤔
With v1's IPC performance i'd do it in Rust (though to be fair i do everything in rust...) but if you're not throttled by speed and find it easier i'd say there's not much wrong about doing it in js (except the possibility to leak the whole fs structure to malicious js code, afaik only really a concern if your app interacts with something on the internet) |
Beta Was this translation helpful? Give feedback.
Yeah, so using rust is really the closest you'll get to it since that's the actual cwd of the program. While tauri's cli is typically aware of the project's root the tauri crate is not, Can't think of an automatic way to get the dir you're expecting rn 🤔