Fall back to HOME/Desktop instead of HOME if XDG_DESKTOP_DIR not found

This commit is contained in:
Jeremy Soller 2024-10-04 07:54:08 -06:00
parent d3f91e6457
commit 4e8ae6ad20
No known key found for this signature in database
GPG key ID: D02FD439211AF56F

View file

@ -49,7 +49,11 @@ pub fn desktop() -> Result<(), Box<dyn std::error::Error>> {
let locations = vec![
match dirs::desktop_dir() {
Some(path) => Location::Path(path),
None => Location::Path(home_dir()),
None => {
let path = home_dir().join("Desktop");
log::warn!("failed to find XDG_DESKTOP_DIR, falling back to {path:?}");
Location::Path(path)
}
}
];