From 8d681a16fd91b6f8f69b5fc56c227e0500bd9bb6 Mon Sep 17 00:00:00 2001 From: edu4rdshl Date: Mon, 25 May 2026 03:43:52 -0500 Subject: [PATCH] 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> --- strata-daemon/src/config.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/strata-daemon/src/config.rs b/strata-daemon/src/config.rs index f18345c..e61db86 100644 --- a/strata-daemon/src/config.rs +++ b/strata-daemon/src/config.rs @@ -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) {