fix: panic with clear message if XDG data dir is unavailable

The previous fallback to PathBuf::from(".") silently placed the
database in whatever the current working directory was, making it
impossible to find later. Since the daemon cannot function without a
persistent database, failing fast with an actionable message is the
correct behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Eduard Tolosa 2026-05-25 03:43:52 -05:00
parent eb64476a2a
commit 8d681a16fd

View file

@ -8,7 +8,10 @@ pub struct Config {
impl Config {
pub fn new() -> Self {
let data_dir = dirs::data_dir()
.unwrap_or_else(|| PathBuf::from("."))
.expect(
"Could not determine XDG data directory. \
Ensure $XDG_DATA_HOME or $HOME is set.",
)
.join("strata");
if let Err(e) = std::fs::create_dir_all(&data_dir) {