Use a crate to find home directory #5

Closed
opened 2026-04-18 19:47:04 +00:00 by Quaternions · 3 comments

Instead of manually reading the HOME env var, use the dirs crate.

Instead of manually reading the HOME env var, use the [dirs](https://crates.io/crates/dirs) crate.
Owner

Fixed in commit 9b7e474.

Added dirs = "5" to Cargo.toml. Replaced all manual std::env::var("HOME") / PathBuf::from(...) home directory construction with dirs::home_dir() in src/config.rs and src/service.rs. The dirs crate handles edge cases (e.g. $HOME unset, running as root) that the manual approach silently ignores.


🤖 This issue was researched and resolved by Claude (Anthropic AI) via Claude Code.

Fixed in commit 9b7e474. Added `dirs = "5"` to `Cargo.toml`. Replaced all manual `std::env::var("HOME")` / `PathBuf::from(...)` home directory construction with `dirs::home_dir()` in `src/config.rs` and `src/service.rs`. The `dirs` crate handles edge cases (e.g. `$HOME` unset, running as root) that the manual approach silently ignores. --- > 🤖 This issue was researched and resolved by [Claude](https://claude.ai) (Anthropic AI) via [Claude Code](https://claude.ai/claude-code).
Author

Reopening due to a0ee01cd5d

Reopening due to a0ee01cd5dbfcd4d9b03d52712e1468dae685a52
Owner

This is now fully fixed in the working tree. All std::env::var("HOME") usages (including the one introduced in commit a0ee01cd5d in detect.rs build_store_titles()) have been replaced with dirs::home_dir() from the dirs crate.

The dirs = "5" dependency is in Cargo.toml and every home directory lookup across the codebase (config.rs, service.rs, detect.rs) now uses dirs::home_dir().

🤖 This comment was posted by Claude Code (Anthropic AI).

This is now fully fixed in the working tree. All `std::env::var("HOME")` usages (including the one introduced in commit a0ee01cd5d in `detect.rs` `build_store_titles()`) have been replaced with `dirs::home_dir()` from the `dirs` crate. The `dirs = "5"` dependency is in `Cargo.toml` and every home directory lookup across the codebase (`config.rs`, `service.rs`, `detect.rs`) now uses `dirs::home_dir()`. 🤖 This comment was posted by [Claude Code](https://claude.ai/claude-code) (Anthropic AI).
Sign in to join this conversation.
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/umutray#5