ojosproject / iris

Iris, the at-home hospice management system by the Ojos Project. Made with 💙💛 at UCI.
https://ojosproject.org/iris/
GNU General Public License v3.0
1 stars 1 forks source link

Initial folder creation causes issues between macOS/Linux #41

Closed calejvaldez closed 1 week ago

calejvaldez commented 1 week ago

Summary

When starting Iris for the first time on macOS, the program crashes because we attempt to create a new folder in this line:

https://github.com/ojosproject/iris/blob/de60ec9cf8c389ab32a6844c2181e371597f0479/src-tauri/src/config.rs#L41

However, if we remove it and start the program on the first time on Linux, the program crashes because the app_config_dir was not created.

The issue is that on macOS, both app_data_dir and app_config_dir are the same folder, but on Linux they're not.

What is the expected correct behavior?

Folders created without issues, regardless of OS.

Steps to reproduce

  1. Delete any Iris data you have by deleting your app_data_dir and app_config_dir folders
  2. Attempt to start Iris for the first time

Relevant logs and/or screenshots

    Running BeforeDevCommand (`npm run dev`)

> iris@0.0.0 dev
> next dev

  ▲ Next.js 14.2.5
  - Local:        http://localhost:3000

 ✓ Starting...
 ✓ Ready in 793ms
    Info Watching /Users/calejvaldez/git/ojos/iris/src-tauri for changes...
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.27s
Iris DB location: "/Users/calejvaldez/Library/Application Support/org.ojosproject.Iris/iris.db"
Use the "Help" menu to open it on your computer.
thread 'main' panicked at src/config.rs:41:47:
called `Result::unwrap()` on an `Err` value: Os { code: 17, kind: AlreadyExists, message: "File exists" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
libc++abi: terminating due to uncaught foreign exception

Operating System

macOS

calejvaldez commented 1 week ago

Fixed in 3ef66313c43773a22022b890757c470111707f73

This was a Linux-only issue since its app_data_dir leads to ~/.local/share/org.ojosproject.Iris/ and its app_config_dir leads to ~/.config/org.ojosproject.Iris/, which is common for Linux but was still a pain to discover that they were two different folders.

Both Windows and macOS' app_data_dir and app_config_dir lead to the same folder, so it didn't affect those OS.