runrig-coop / early-warning-system

An early warning system for Richland Gro-Op to coordinate field health.
GNU General Public License v3.0
2 stars 1 forks source link

FIX: Backend crashes when trying to save if `.cache/` directory does not exist #24

Closed jgaehring closed 4 months ago

jgaehring commented 10 months ago

This is a result of c3ac7b0 and should be pretty simple to fix but I'm focusing on the frontend at the moment. Basically we just need to check the directory is there and if not create it before trying to open the path. Simple, but I want to use it to familiarize myself a little better with Rust standard library for working with the file system, best practices, etc.

jgaehring commented 10 months ago

Somewhat related to this and #27 (but perhaps worthy of a separate issue) is to work out the best place to store this file for the binary we actually distribute to users.

jgaehring commented 5 months ago

From #33:

It looks like I didn't actually fix #24 like I thought. Running the .AppImage and doing anything that tries to write to the file system crashes the whole app. I neglected to read the docs on Embedding Additional Files.

I guess this isn't technically the same issue, where the directory doesn't exist so it crashes. It's more a matter of the Tauri config and maybe some file permissions. Docs look pretty straightforward though, so hopefully a quick fix.

jgaehring commented 4 months ago

I wound up just moving all the file system operations to the TypeScript frontend (e99b8d5), since most of the Tauri fs API seems geared towards that end. I'm sure that it's possible to do all the same more directly with the Tauri Rust API, or more likely, just by using the Rust std lib's fs API. That will certainly improve performance for more advanced data storage and networking in the future, but none of that is strictly necessary at the moment.