fix(config): use XDG picture directory as default

Replace hardcoded \"~/Pictures\" with dirs::picture_dir() which resolves
to the actual absolute path (e.g. /home/user/Pictures).

The tilde (~) in paths is not automatically expanded by Rust's PathBuf,
causing path.exists() to return false for \"~/Pictures\".

Using dirs::picture_dir() provides:
- Proper absolute path resolution
- XDG Base Directory compliance
- Fallback to home directory if Pictures doesn't exist

Note: Users with existing config files need to delete
~/.config/cosmic/org.codeberg.wfx.Noctua/v1/default_image_dir
to apply the new default."
This commit is contained in:
wfx 2026-01-14 20:54:42 +01:00
parent afdee6b430
commit e71a97a2cb
4 changed files with 53 additions and 10 deletions

View file

@ -21,8 +21,7 @@ pub struct AppConfig {
impl Default for AppConfig {
fn default() -> Self {
Self {
// TODO: Use xdg dir for picture
default_image_dir: Some(PathBuf::from("~/Pictures")),
default_image_dir: dirs::picture_dir().or_else(dirs::home_dir),
nav_bar_visible: false,
context_drawer_visible: false,
}