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