Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we avoid using xdg-data-dirs in main.rs? #118

Closed
Animeshz opened this issue Dec 16, 2023 · 1 comment · Fixed by #119
Closed

Can we avoid using xdg-data-dirs in main.rs? #118

Animeshz opened this issue Dec 16, 2023 · 1 comment · Fixed by #119
Labels
type: bug Something isn't working

Comments

@Animeshz
Copy link

Animeshz commented Dec 16, 2023

Describe the bug

Originating from https://github.com/franciscoBSalgueiro/en-croissant/blob/v0.7.1/src-tauri/src/main.rs#L82

thread 'main' panicked at src/main.rs:181:18:
called `Result::unwrap()` on an `Err` value: Path("unable to determine base dir path")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Reproduction

Happens when user doesn't have xdg-data-dirs package installed. resolve_path() on (BaseDirectory::Document, "EnCroissant"), is only possible in linux when xdg-data-dirs is installed and set to be used. Which is generally not always the case, specially when we're not using 100% xdg complaint systems.

Can we try to avoid using user's Document directory for creating files?

Also, it took me few tries to find the culprit, can we also improve the error messages (avoid using unwrap() and maybe atleast expect() to give more useful information)?

Thanks!

Platform and versions

OS: Void Linux (base) - glibc latest

Stack trace

No response

@Animeshz Animeshz added the type: bug Something isn't working label Dec 16, 2023
@franciscoBSalgueiro franciscoBSalgueiro linked a pull request Dec 17, 2023 that will close this issue
@franciscoBSalgueiro
Copy link
Owner

Thanks, I try to minimize the amount of unwraps, but I'm also often lazy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants