fix: use XDG data directory as default storage location

Changes default from ~/.keep to /keep
(e.g. ~/.local/share/keep on Linux). Uses dirs::data_dir() which
respects XDG_DATA_HOME environment variable.
This commit is contained in:
2026-03-17 15:37:25 -03:00
parent 28c3deaeca
commit c29e37c03e

View File

@@ -573,8 +573,8 @@ impl Settings {
pub fn default_dir() -> anyhow::Result<PathBuf> { pub fn default_dir() -> anyhow::Result<PathBuf> {
let mut path = let mut path =
dirs::home_dir().ok_or_else(|| anyhow::anyhow!("No home directory found"))?; dirs::data_dir().ok_or_else(|| anyhow::anyhow!("No data directory found"))?;
path.push(".keep"); path.push("keep");
if !path.exists() { if !path.exists() {
std::fs::create_dir_all(&path)?; std::fs::create_dir_all(&path)?;
} }